Exemple #1
0
        public Models.MemberTypeDo GetMemberType(Models.MemberTypeCriteriaDo criteria)
        {
            Models.MemberTypeDo result = null;

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Get_MemberType]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(int), "MemberTypeID", criteria.MemberTypeID);

                System.Collections.IList[] dbls = command.ToList(typeof(Models.MemberTypeDo), typeof(Models.MemberTypeBrandDo));
                if (dbls != null)
                {
                    List <Models.MemberTypeDo> dbmts       = dbls[0] as List <Models.MemberTypeDo>;
                    List <Models.MemberTypeBrandDo> dbmtbs = dbls[1] as List <Models.MemberTypeBrandDo>;
                    if (dbmts != null)
                    {
                        if (dbmts.Count > 0)
                        {
                            result = dbmts[0];

                            if (dbmtbs != null)
                            {
                                result.Brands = dbmtbs;
                            }
                        }
                    }
                }
            }));

            return(result);
        }
Exemple #2
0
        public Models.UpdateMemberTypeResultDo CreateMemberType(Models.MemberTypeDo entity)
        {
            Models.UpdateMemberTypeResultDo result = new Models.UpdateMemberTypeResultDo();

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Create_MemberType]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(string), "MemberTypeName", entity.MemberTypeName);
                command.AddParameter(typeof(string), "Remark", entity.Remark);

                command.AddParameter(typeof(decimal), "CreditDiscountValue", entity.CreditDiscountValue);
                command.AddParameter(typeof(string), "CreditDiscountType", entity.CreditDiscountType);

                command.AddParameter(typeof(decimal), "CashDiscountValue", entity.CashDiscountValue);
                command.AddParameter(typeof(string), "CashDiscountType", entity.CashDiscountType);

                command.AddParameter(typeof(int), "MemberLifeType", entity.MemberLifeType);
                command.AddParameter(typeof(DateTime), "StartPeriod", entity.StartPeriod);
                command.AddParameter(typeof(DateTime), "EndPeriod", entity.EndPeriod);
                command.AddParameter(typeof(bool), "FlagActive", entity.FlagActive);
                command.AddParameter(typeof(decimal), "Lifetime", entity.Lifetime);
                command.AddParameter(typeof(decimal), "Price", entity.Price);

                string brandXml = Utils.ConvertUtil.ConvertToXml_Store <Models.MemberTypeBrandDo>(entity.Brands);
                command.AddParameter(typeof(string), "BrandXML", brandXml);

                command.AddParameter(typeof(DateTime), "CreateDate", entity.CreateDate);
                command.AddParameter(typeof(string), "CreateUser", entity.CreateUser);

                Utils.SQL.ISQLDbParameter error = command.AddErrorParameter();

                System.Collections.IList[] dbls = command.ToList(typeof(Models.MemberTypeDo), typeof(Models.MemberTypeBrandDo));
                if (dbls != null)
                {
                    List <Models.MemberTypeDo> dbmts       = dbls[0] as List <Models.MemberTypeDo>;
                    List <Models.MemberTypeBrandDo> dbmtbs = dbls[1] as List <Models.MemberTypeBrandDo>;
                    if (dbmts != null)
                    {
                        if (dbmts.Count > 0)
                        {
                            result.MemberType = dbmts[0];

                            if (dbmtbs != null)
                            {
                                result.MemberType.Brands = dbmtbs;
                            }
                        }
                    }
                }

                result.ErrorParameter(error);
            }));

            return(result);
        }
Exemple #3
0
        public void DeleteMemberType(Models.MemberTypeDo entity)
        {
            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Delete_MemberType]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(int), "MemberTypeID", entity.MemberTypeID);

                command.ExecuteNonQuery();
            }));
        }