当前位置: 首页>>代码示例>>C#>>正文


C# DataLayer.Connect方法代码示例

本文整理汇总了C#中DataLayer.Connect方法的典型用法代码示例。如果您正苦于以下问题:C# DataLayer.Connect方法的具体用法?C# DataLayer.Connect怎么用?C# DataLayer.Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataLayer的用法示例。


在下文中一共展示了DataLayer.Connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetMediaGroup

        public MediaGroup GetMediaGroup(int MediaID)
        {
            DataLayer dal = new DataLayer();
            dal.ConnectionString = ConnectionString;
            dal.Connect();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetMediaGroup";

            cmd.Parameters.AddWithValue("@MediaID", MediaID);

            DataTable dt = dal.Execute(cmd);

            DataRow dr = dt.Rows[0];
            return new MediaGroup
            {
                MediaID = Int32.Parse(dr["MediaID"].ToString()),
                MediaTitle = dr["MediaTitle"].ToString(),
                MediaType = dr["MediaType"].ToString(),
                ProductID = Int32.Parse(dr["ProductID"].ToString()),
                Active = bool.Parse(dr["Active"].ToString()),
                DateCreated = DateTime.Parse(dr["DateCreated"].ToString())
            };
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:25,代码来源:Admin.cs

示例2: GetMediaGroups

        public List<MediaGroup> GetMediaGroups()
        {
            DataLayer dal = new DataLayer();
            dal.ConnectionString = ConectionString;
            dal.Connect();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetMediaGroups";

            DataTable dt = dal.Execute(cmd);
            List<MediaGroup> MediaGroups = new List<MediaGroup>();

            foreach (DataRow dr in dt.Rows)
            {
                MediaGroup mediagroup = new MediaGroup
                {
                    MediaID = Int32.Parse(dr["MediaID"].ToString()),
                    MediaTitle = dr["MediaTitle"].ToString(),
                    MediaType = dr["MediaType"].ToString(),
                    DateCreated = DateTime.Parse(dr["DateCreated"].ToString())
                };

                MediaGroups.Add(mediagroup);

            }
            return MediaGroups;
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:28,代码来源:Media.cs

示例3: GetMediaGroupItem

        public MediaGroupItem GetMediaGroupItem(string AssetID)
        {
            DataLayer dal = new DataLayer();
            dal.ConnectionString = ConnectionString;
            dal.Connect();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetMediaGroupItem";
            cmd.Parameters.AddWithValue("@AssetID", AssetID);

            DataTable dt = dal.Execute(cmd);

            foreach (DataRow dr in dt.Rows)
            {
                MediaGroupItem mediagroupitem = new MediaGroupItem
                {
                    MediaID = Int32.Parse(dr["MediaID"].ToString()),
                    AssetID = dr["AssetID"].ToString(),
                    FileName = dr["FileName"].ToString(),
                    PreviewImageURL = dr["PreviewImage"].ToString(),
                    FilePath = dr["FilePath"].ToString(),
                    PermanentLinkURL = dr["PermanentLink"].ToString(),
                    Sort = Int32.Parse(dr["Sort"].ToString())
                };

                return mediagroupitem;
            }

            return null;
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:31,代码来源:Admin.cs

示例4: GetMaxOrderNo

        public static int GetMaxOrderNo()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetMaxOrderNo";

            DataLayer dal = new DataLayer();
            dal.ConnectionString = Properties.Settings.Default.ConnectionString;
            dal.Connect();

            DataRow row = dal.Execute(cmd).Rows[0];

            return Int32.Parse(row["OrderNo"].ToString());
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:14,代码来源:Helper.cs

示例5: DeleteMediaGroup

        public void DeleteMediaGroup(int MediaID)
        {
            DataLayer dal = new DataLayer();
            dal.ConnectionString = ConnectionString;
            dal.Connect();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "DeleteMediaGroup";

            cmd.Parameters.AddWithValue("@MediaID", MediaID);

            dal.ExecuteProcNonQuery(cmd);
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:14,代码来源:Admin.cs

示例6: GetMaxCustomerLastUpdateDate

        public static DateTime GetMaxCustomerLastUpdateDate()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetMaxCustomerLastUpdateDate";

            DataLayer dal = new DataLayer();
            dal.ConnectionString = Properties.Settings.Default.ConnectionString;
            dal.Connect();

            DataRow row = dal.Execute(cmd).Rows[0];

            return  DateTime.Parse(row["LastUpdated"].ToString());
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:14,代码来源:Helper.cs

示例7: Save

        public bool Save()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddOrderPayment";

            cmd.Parameters.AddWithValue("@OrderNo", OrderNo);
            cmd.Parameters.AddWithValue("@CreditCardType", CreditCardType);
            cmd.Parameters.AddWithValue("@CreditCardNumber", CreditCardNumber);
            cmd.Parameters.AddWithValue("@CreditCardExpDate", CreditCardExpDate);
            cmd.Parameters.AddWithValue("@PaymentMethod", PaymentMethod);

            DataLayer dal = new DataLayer();
            dal.ConnectionString = Properties.Settings.Default.ConnectionString;
            dal.Connect();

            dal.Execute(cmd);

            return true;
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:20,代码来源:Payment.cs

示例8: EmailExists

        public static bool EmailExists(string email)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "IsExistingEmail";

            cmd.Parameters.AddWithValue("@Email", email);

            DataLayer dal = new DataLayer();
            dal.ConnectionString = ConectionString;
            dal.Connect();

            DataTable dt = dal.Execute(cmd);

            if (dt.Rows.Count > 0)
            {
                return true;
            }

            return false;
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:21,代码来源:Helper.cs

示例9: Update

        public bool Update()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "UpdateMediaGroupItem";

            cmd.Parameters.AddWithValue("@AssetID", AssetID);
            cmd.Parameters.AddWithValue("@FileName", FileName);
            cmd.Parameters.AddWithValue("@FilePath", FilePath);
            cmd.Parameters.AddWithValue("@PermanentLink", PermanentLinkURL);
            cmd.Parameters.AddWithValue("@PreviewImage", PreviewImageURL);
            cmd.Parameters.AddWithValue("@Sort", Sort);

            DataLayer dal = new DataLayer();
            dal.ConnectionString = ConnectionString;
            dal.Connect();

            dal.Execute(cmd);

            return true;
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:21,代码来源:Admin.cs

示例10: Save

        public bool Save()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddMediaGroup";

            cmd.Parameters.AddWithValue("@MediaID", MediaID);
            cmd.Parameters.AddWithValue("@MediaTitle", MediaTitle);
            cmd.Parameters.AddWithValue("@MediaType", MediaType);
            cmd.Parameters.AddWithValue("@ProductID", ProductID);
            cmd.Parameters.AddWithValue("@Active", Active);

            DataLayer dal = new DataLayer();
            dal.ConnectionString = ConnectionString;
            dal.Connect();

            dal.Execute(cmd);

            return true;
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:20,代码来源:Admin.cs

示例11: GetMediaGroupItems

        public DataTable GetMediaGroupItems(int MediaID)
        {
            DataLayer dal = new DataLayer();
            dal.ConnectionString = ConnectionString;
            dal.Connect();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetMediaGroupItems";
            cmd.Parameters.AddWithValue("@MediaID", MediaID);

            return  dal.Execute(cmd);
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:13,代码来源:Admin.cs

示例12: ReportGet

        public static DataTable ReportGet()
        {
            DataLayer dal = new DataLayer();
            dal.ConnectionString = ConectionString;
            dal.Connect();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "UsersGet";
            return dal.Execute(cmd);
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:11,代码来源:Helper.cs

示例13: Save

        public bool Save()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddOrder";

            cmd.Parameters.AddWithValue("@OrderNo", OrderNo);
            cmd.Parameters.AddWithValue("@OrderDate", OrderDate);
            cmd.Parameters.AddWithValue("@OrderType", OrderType);
            cmd.Parameters.AddWithValue("@OrderStatus", OrderStatus);
            cmd.Parameters.AddWithValue("@ShipDate", ShipDate);
            cmd.Parameters.AddWithValue("@BillingStatus", BillingStatus);
            cmd.Parameters.AddWithValue("@OrderAmount", OrderAmount);
            cmd.Parameters.AddWithValue("@OrderNet", OrderNet);
            cmd.Parameters.AddWithValue("@PlacedBy", PlacedBy);
            cmd.Parameters.AddWithValue("@LastUpdate", LastUpdate);
            cmd.Parameters.AddWithValue("@LastUpdateBy", LastUpdateBy);
            cmd.Parameters.AddWithValue("@IpAddress", IpAdress);
            cmd.Parameters.AddWithValue("@IpAddress_CountryCode", IpAdress_CountryCode);
            cmd.Parameters.AddWithValue("@CustomerNo", CustomerNo);
            cmd.Parameters.AddWithValue("@Email", Email);

            DataLayer dal = new DataLayer();
            dal.ConnectionString = Properties.Settings.Default.ConnectionString;
            dal.Connect();

            dal.Execute(cmd);

            return true;
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:30,代码来源:Order.cs

示例14: SetOrderLastUpd

        public static void SetOrderLastUpd()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "SetOrderLastUpd";

            DataLayer dal = new DataLayer();
            dal.ConnectionString = Properties.Settings.Default.ConnectionString;
            dal.Connect();

            dal.Execute(cmd);
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:12,代码来源:Helper.cs

示例15: GetUnshippedOrders

        public static List<int> GetUnshippedOrders()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetUnShippedOrders";

            DataLayer dal = new DataLayer();
            dal.ConnectionString = Properties.Settings.Default.ConnectionString;
            dal.Connect();

            DataTable dt = dal.Execute(cmd);

            List<int> OrderNos = new List<int>();

            foreach (DataRow dr in dt.Rows)
            {
                OrderNos.Add(Int32.Parse(dr["OrderNo"].ToString()));
            }

            return OrderNos;
        }
开发者ID:lchambaka,项目名称:WorkPad,代码行数:21,代码来源:Helper.cs


注:本文中的DataLayer.Connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。