Example #1
0
        public Models.DiscountDo GetDiscount(Models.DiscountCriteriaDo criteria)
        {
            Models.DiscountDo result = null;

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

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

                System.Collections.IList[] dbls = command.ToList(
                    typeof(Models.DiscountDo), typeof(Models.DiscountBrandDo), typeof(Models.DiscountUserGroupDo));
                if (dbls != null)
                {
                    List <Models.DiscountDo> dbds           = dbls[0] as List <Models.DiscountDo>;
                    List <Models.DiscountBrandDo> dbdbs     = dbls[1] as List <Models.DiscountBrandDo>;
                    List <Models.DiscountUserGroupDo> dbdus = dbls[2] as List <Models.DiscountUserGroupDo>;
                    if (dbds != null)
                    {
                        if (dbds.Count > 0)
                        {
                            result        = dbds[0];
                            result.Brands = dbdbs;
                            result.Groups = dbdus;
                        }
                    }
                }
            }));

            return(result);
        }
Example #2
0
        public Models.DiscountResultDo GetDiscountList(Models.DiscountCriteriaDo criteria)
        {
            Models.DiscountResultDo result = new Models.DiscountResultDo();

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

                command.AddParameter(typeof(string), "DiscountName", criteria.DiscountName);
                command.AddParameter(typeof(decimal), "DiscountValue", criteria.DiscountValue);
                command.AddParameter(typeof(string), "DiscountType", criteria.DiscountType);
                command.AddParameter(typeof(bool), "FlagActive", criteria.FlagActive);

                Utils.SQL.ISQLDbParameter output = command.AddSearchParameter(criteria);

                result.Rows = command.ToList <Models.DiscountFSDo>();
                result.TotalRecordParameter(output);
            }));

            return(result);
        }