Example #1
0
        public Eyousoft_yhq.Model.Product GetModel(string ProductID)
        {
            Eyousoft_yhq.Model.Product model = null;

            StringBuilder strSql = new StringBuilder();

            strSql.AppendFormat("SELECT *,");

            strSql.AppendFormat(" (SELECT Name,FilePath,Size,IsWebImage  FROM tbl_Attach WHERE   ItemId='{0}' FOR XML RAW,ROOT('ROOT'))AS ComAttachXML   ", ProductID);

            strSql.Append("  FROM view_Product   ");
            strSql.Append(" where ProductID=@ProductID ");
            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            this._db.AddInParameter(cmd, "ProductID", System.Data.DbType.AnsiStringFixedLength, ProductID);

            using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db))
            {
                while (dr.Read())
                {
                    model              = new Eyousoft_yhq.Model.Product();
                    model.ProductID    = ProductID;
                    model.ProductName  = dr.GetString(dr.GetOrdinal("ProductName"));
                    model.ProductType  = dr.GetInt32(dr.GetOrdinal("ProductType"));
                    model.TourDate     = dr.IsDBNull(dr.GetOrdinal("TourDate")) ? null : Utils.GetDateTimeNullable(dr.GetDateTime(dr.GetOrdinal("TourDate")).ToString());
                    model.MarketPrice  = dr.GetDecimal(dr.GetOrdinal("MarketPrice"));
                    model.AppPrice     = dr.GetDecimal(dr.GetOrdinal("AppPrice"));
                    model.FavourCode   = dr.GetString(dr.GetOrdinal("FavourCode"));
                    model.LinkTel      = dr.GetString(dr.GetOrdinal("LinkTel"));
                    model.ProductDis   = dr.GetString(dr.GetOrdinal("ProductDis"));
                    model.TourDis      = dr.GetString(dr.GetOrdinal("TourDis"));
                    model.SendTourKnow = dr.GetString(dr.GetOrdinal("SendTourKnow"));
                    model.ValidiDate   = dr.GetDateTime(dr.GetOrdinal("ValidiDate"));
                    //model.ProductState = dr.GetInt32(dr.GetOrdinal("ProductState"));
                    model.AttachList     = this.GetAttachList(dr["ComAttachXML"].ToString(), ProductID);
                    model.IsEveryDay     = dr.IsDBNull(dr.GetOrdinal("IsEveryDay")) ? false : GetBoolean(dr.GetString(dr.GetOrdinal("IsEveryDay")));
                    model.IsHot          = dr.IsDBNull(dr.GetOrdinal("IsHot")) ? 0 : dr.GetByte(dr.GetOrdinal("IsHot"));
                    model.ServiceQQ      = dr.IsDBNull(dr.GetOrdinal("ServiceQQ")) ? "" : dr.GetString(dr.GetOrdinal("ServiceQQ"));
                    model.ContractType   = (Eyousoft_yhq.Model.ContractType)dr.GetByte(dr.GetOrdinal("ContractType"));
                    model.ControlPeople  = dr.GetInt32(dr.GetOrdinal("ControlPeople"));
                    model.ResidueNum     = dr.GetInt32(dr.GetOrdinal("ResidueNum"));
                    model.SaleNum        = dr.GetInt32(dr.GetOrdinal("SaleNum"));
                    model.ProductOpState = (Eyousoft_yhq.Model.ProductOp)dr.GetByte(dr.GetOrdinal("ProductOpState"));
                    model.ProductSdate   = dr.IsDBNull(dr.GetOrdinal("ProductSdate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ProductSdate"));
                    model.ZCodeViaDate   = dr.IsDBNull(dr.GetOrdinal("ZCodeViaDate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ZCodeViaDate"));
                    model.PType          = dr.IsDBNull(dr.GetOrdinal("PType")) ? 1 : dr.GetInt32(dr.GetOrdinal("PType"));
                    model.Scompare       = dr.IsDBNull(dr.GetOrdinal("Scompare")) ? "" : dr.GetString(dr.GetOrdinal("Scompare"));
                    model.FaBuRenId      = dr["FaBuRenId"].ToString();
                    model.ShenHeStatus   = (Eyousoft_yhq.Model.ChanPinShenHeStatus)dr.GetInt32(dr.GetOrdinal("ShenHeStatus"));
                }
            }

            return(model);
        }
Example #2
0
        /// <summary>
        /// 判断微信码是否可用
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Exists(Eyousoft_yhq.Model.Product model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from tbl_Product");
            strSql.Append(" where FavourCode=@FavourCode and  DATEDIFF(day,@ValidiDate,GETDATE())<0");

            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            this._db.AddInParameter(cmd, "FavourCode", System.Data.DbType.String, model.FavourCode);
            this._db.AddInParameter(cmd, "ValidiDate", System.Data.DbType.DateTime, model.ValidiDate);

            return(Convert.ToInt32(DbHelper.GetSingle(cmd, this._db)) > 1 ? true : false);
        }
Example #3
0
        /// <summary>
        /// 初始化页面
        /// </summary>
        /// <param name="id">产品编号</param>
        protected void pageInit(string id)
        {
            var model = EyouSoft.Common.Page.HuiyuanPage.GetUserInfo();

            if (model != null)
            {
                hybh = model.UserID;
            }
            Eyousoft_yhq.BLL.Product bll = new Eyousoft_yhq.BLL.Product();
            gModel = new Eyousoft_yhq.Model.Product();
            gModel = bll.GetModel(id);
            if (gModel != null)
            {
                lbl_ProName.Text = gModel.ProductName;
                shichangjia      = gModel.MarketPrice.ToString("C0");
                appjia           = gModel.AppPrice.ToString("C0");
                dianhua          = gModel.LinkTel;
                descript         = Utils.GetText2(gModel.ProductDis, 30, true);
                //Lit_chutuan.Text = gModel.SendTourKnow.Replace("\n", "<br/>");
                //Lit_conpair.Text = gModel.Scompare.Replace("\n", "<br/>");

                //Lit_xingcheng.Text = gModel.TourDis.Replace("\n", "<br/>");
                //Lit_jieshao.Text = gModel.ProductDis.Replace("\n", "<br/>");
                yhm        = gModel.FavourCode;
                pinglunshu = new Eyousoft_yhq.BLL.Comment().GetCountNum(gModel.ProductID).ToString();
                if (DateTime.Compare(DateTime.Now, Utils.GetDateTime(gModel.ValidiDate.ToString())) > 0 && !gModel.IsEveryDay)
                {
                    spanResult.Visible = false;
                }
                switch (gModel.PType)
                {
                case 2:
                    lit_Menu.Text = string.Format("<div class=\"pro_content\"> <h3><ul class=\"tiaozheng\"><li li_index=\"1\" class=\"active\">产品介绍</li><li li_index=\"2\">使用须知</li></ul></h3><div class=\"contentbox\"><div>{0}</div><div style=\"display: none\">{1}</div> </div><div><img src=\"/images/pro_b.png\" width=\"300\"></div></div>", gModel.ProductDis.Replace("\n", "<br/>"), gModel.SendTourKnow.Replace("\n", "<br/>"));
                    break;

                case 3:
                    lit_Menu.Text = string.Format("<div class=\"pro_content\"> <h3><ul class=\"tiaozheng\"><li li_index=\"1\" class=\"active\">产品介绍</li><li li_index=\"2\">使用须知</li></ul></h3><div class=\"contentbox\"><div>{0}</div><div style=\"display: none\">{1}</div> </div><div><img src=\"/images/pro_b.png\" width=\"300\"></div></div>", gModel.ProductDis.Replace("\n", "<br/>"), gModel.SendTourKnow.Replace("\n", "<br/>"));
                    break;

                default:
                    lit_Menu.Text = string.Format("<div class=\"pro_content\"> <h3><ul class=\"tiaozheng\"><li li_index=\"1\" class=\"active\">产品介绍</li><li li_index=\"2\">参考行程</li><li li_index=\"3\">出团须知</li><li li_index=\"4\">同类比较</li></ul></h3><div class=\"contentbox\"><div>{0}</div><div style=\"display: none\">{1}</div> <div style=\"display: none\">{2}</div><div style=\"display: none\">{3}</div></div><div><img src=\"/images/pro_b.png\" width=\"300\"></div></div>", gModel.ProductDis.Replace("\n", "<br/>"), gModel.TourDis.Replace("\n", "<br/>"), gModel.SendTourKnow.Replace("\n", "<br/>"), gModel.Scompare);
                    break;
                }
            }
            else
            {
                lit_Menu.Text = string.Format("<div class=\"pro_content\"> <h3><ul class=\"tiaozheng\"><li li_index=\"1\" class=\"active\">产品介绍</li><li li_index=\"2\">参考行程</li><li li_index=\"3\">出团须知</li><li li_index=\"4\">同类比较</li></ul></h3><div class=\"contentbox\"><div></div><div style=\"display: none\"></div> <div style=\"display: none\"></div><div style=\"display: none\"></div></div><div><img src=\"/images/pro_b.png\" width=\"300\"></div></div>");
            }
        }
Example #4
0
        /// <summary>
        /// 初始化页面
        /// </summary>
        /// <param name="id">产品编号</param>
        protected void pageInit(string id)
        {
            var model = EyouSoft.Common.Page.HuiyuanPage.GetUserInfo();
            if (model != null)
            {
                hybh = model.UserID;

            }
            Eyousoft_yhq.BLL.Product bll = new Eyousoft_yhq.BLL.Product();
            gModel = new Eyousoft_yhq.Model.Product();
            gModel = bll.GetModel(id);
            if (gModel != null)
            {
                lbl_ProName.Text = gModel.ProductName;
                shichangjia = gModel.MarketPrice.ToString("C0");
                appjia = gModel.AppPrice.ToString("C0");
                dianhua = gModel.LinkTel;
                descript = Utils.GetText2(gModel.ProductDis, 30, true);
                //Lit_chutuan.Text = gModel.SendTourKnow.Replace("\n", "<br/>");
                //Lit_conpair.Text = gModel.Scompare.Replace("\n", "<br/>");

                //Lit_xingcheng.Text = gModel.TourDis.Replace("\n", "<br/>");
                //Lit_jieshao.Text = gModel.ProductDis.Replace("\n", "<br/>");
                yhm = gModel.FavourCode;
                pinglunshu = new Eyousoft_yhq.BLL.Comment().GetCountNum(gModel.ProductID).ToString();
                if (DateTime.Compare(DateTime.Now, Utils.GetDateTime(gModel.ValidiDate.ToString())) > 0 && !gModel.IsEveryDay)
                {
                    spanResult.Visible = false;
                }
                switch (gModel.PType)
                {
                    case 2:
                        lit_Menu.Text = string.Format("<div class=\"pro_content\"> <h3><ul class=\"tiaozheng\"><li li_index=\"1\" class=\"active\">产品介绍</li><li li_index=\"2\">使用须知</li></ul></h3><div class=\"contentbox\"><div>{0}</div><div style=\"display: none\">{1}</div> </div><div><img src=\"/images/pro_b.png\" width=\"300\"></div></div>", gModel.ProductDis.Replace("\n", "<br/>"), gModel.SendTourKnow.Replace("\n", "<br/>"));
                        break;
                    case 3:
                        lit_Menu.Text = string.Format("<div class=\"pro_content\"> <h3><ul class=\"tiaozheng\"><li li_index=\"1\" class=\"active\">产品介绍</li><li li_index=\"2\">使用须知</li></ul></h3><div class=\"contentbox\"><div>{0}</div><div style=\"display: none\">{1}</div> </div><div><img src=\"/images/pro_b.png\" width=\"300\"></div></div>", gModel.ProductDis.Replace("\n", "<br/>"), gModel.SendTourKnow.Replace("\n", "<br/>"));
                        break;
                    default:
                        lit_Menu.Text = string.Format("<div class=\"pro_content\"> <h3><ul class=\"tiaozheng\"><li li_index=\"1\" class=\"active\">产品介绍</li><li li_index=\"2\">参考行程</li><li li_index=\"3\">出团须知</li><li li_index=\"4\">同类比较</li></ul></h3><div class=\"contentbox\"><div>{0}</div><div style=\"display: none\">{1}</div> <div style=\"display: none\">{2}</div><div style=\"display: none\">{3}</div></div><div><img src=\"/images/pro_b.png\" width=\"300\"></div></div>", gModel.ProductDis.Replace("\n", "<br/>"), gModel.TourDis.Replace("\n", "<br/>"), gModel.SendTourKnow.Replace("\n", "<br/>"), gModel.Scompare);
                        break;
                }

            }
            else
            {
                lit_Menu.Text = string.Format("<div class=\"pro_content\"> <h3><ul class=\"tiaozheng\"><li li_index=\"1\" class=\"active\">产品介绍</li><li li_index=\"2\">参考行程</li><li li_index=\"3\">出团须知</li><li li_index=\"4\">同类比较</li></ul></h3><div class=\"contentbox\"><div></div><div style=\"display: none\"></div> <div style=\"display: none\"></div><div style=\"display: none\"></div></div><div><img src=\"/images/pro_b.png\" width=\"300\"></div></div>");
            }
        }
Example #5
0
        /// <summary>
        /// 产品添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Add(Eyousoft_yhq.Model.Product model)
        {
            DbCommand cmd = this._db.GetStoredProcCommand("Proc_Product_Add");

            _db.AddInParameter(cmd, "ProductID", DbType.String, model.ProductID);
            _db.AddInParameter(cmd, "ProductName", DbType.String, model.ProductName);
            _db.AddInParameter(cmd, "ProductType", DbType.Int32, model.ProductType);
            _db.AddInParameter(cmd, "TourDate", DbType.DateTime, model.TourDate);
            _db.AddInParameter(cmd, "MarketPrice", DbType.Decimal, model.MarketPrice);
            _db.AddInParameter(cmd, "AppPrice", DbType.Decimal, model.AppPrice);
            _db.AddInParameter(cmd, "FavourCode", DbType.String, model.FavourCode);
            _db.AddInParameter(cmd, "LinkTel", DbType.String, model.LinkTel);
            _db.AddInParameter(cmd, "ProductDis", DbType.String, model.ProductDis);
            _db.AddInParameter(cmd, "TourDis", DbType.String, model.TourDis);
            _db.AddInParameter(cmd, "SendTourKnow", DbType.String, model.SendTourKnow);
            _db.AddInParameter(cmd, "ValidiDate", DbType.String, model.ValidiDate);
            _db.AddInParameter(cmd, "ProductState", DbType.Byte, model.ProductState);
            _db.AddInParameter(cmd, "ComAttachXML", DbType.Xml, CreateComNoticeXML(model.AttachList));
            _db.AddInParameter(cmd, "IsEveryDay", DbType.Byte, model.IsEveryDay);
            _db.AddInParameter(cmd, "IsHot", DbType.Int32, model.IsHot);
            _db.AddInParameter(cmd, "ServiceQQ", DbType.String, model.ServiceQQ);
            _db.AddInParameter(cmd, "ContractType", DbType.Byte, (int)model.ContractType);
            _db.AddInParameter(cmd, "ControlPeople", DbType.Int32, model.ControlPeople);
            _db.AddInParameter(cmd, "Scompare", DbType.String, model.Scompare);

            #region 车票 门票修改
            _db.AddInParameter(cmd, "ProductOpState", DbType.Byte, model.ProductOpState);
            _db.AddInParameter(cmd, "ProductSdate", DbType.DateTime, model.ProductSdate);
            _db.AddInParameter(cmd, "ZCodeViaDate", DbType.DateTime, model.ZCodeViaDate);
            _db.AddInParameter(cmd, "PType", DbType.Int32, model.PType);
            #endregion



            this._db.AddOutParameter(cmd, "result", DbType.Int32, 4);

            _db.AddInParameter(cmd, "FaBuRenId", DbType.AnsiStringFixedLength, model.FaBuRenId);
            _db.AddInParameter(cmd, "ShenHeStatus", DbType.Int32, model.ShenHeStatus);

            DbHelper.RunProcedureWithResult(cmd, this._db);

            return(Convert.ToInt32(this._db.GetParameterValue(cmd, "Result")) > 0 ? true : false);
        }
Example #6
0
        protected void pageSave(string doType)
        {
            string id    = Utils.GetQueryStringValue("id");
            var    model = new Eyousoft_yhq.Model.Product();

            #region 实体赋值

            model.ProductName = Utils.GetFormValue(txtproductName.UniqueID);
            model.ProductType = 0;
            model.TourDate    = Utils.GetDateTimeNullable(Utils.GetFormValue(txtsendDate.UniqueID));
            model.MarketPrice = Utils.GetDecimal(Utils.GetFormValue(txtmarkPrice.UniqueID));
            model.AppPrice    = Utils.GetDecimal(Utils.GetFormValue(txtappPrice.UniqueID));
            //model.FavourCode = Utils.GetFormValue(txtcoupons.UniqueID);
            model.LinkTel       = Utils.GetFormValue(txttel.UniqueID);
            model.ProductDis    = Utils.GetFormValue(txtdescript.UniqueID);
            model.TourDis       = Utils.GetFormValue(txtStation.UniqueID);
            model.SendTourKnow  = Utils.GetFormValue(txtjoury.UniqueID);
            model.ValidiDate    = Utils.GetDateTime(Utils.GetFormValue(txtValidate.UniqueID));
            model.ProductState  = 0;
            model.AttachList    = NewGetAttach();
            model.IsEveryDay    = false;
            model.IsHot         = 0;
            model.ServiceQQ     = Utils.GetFormValue(txtkfqq.UniqueID);
            model.ContractType  = Model.ContractType.车票;
            model.ControlPeople = Utils.GetInt(Utils.GetFormValue(txtPeopleNum.UniqueID));
            model.FavourCode    = Utils.GetFormValue(txtWXcode.UniqueID);

            model.ProductSdate   = Utils.GetDateTime(Utils.GetFormValue(txtsendsDate.UniqueID));
            model.ProductOpState = (Model.ProductOp)Utils.GetInt(Utils.GetFormValue(ddl_proType.UniqueID));
            model.ZCodeViaDate   = Utils.GetDateTime(Utils.GetFormValue(txtZxingdate.UniqueID));
            model.PType          = 3;
            #endregion

            cn.myvo.smc.Service sms = new cn.myvo.smc.Service();
            string IsContact        = sms.IsIncludeKeyWord(model.ProductName);

            #region 提交保存
            bool   result = false;
            string msg    = "";

            if (string.IsNullOrEmpty(IsContact))
            {
                Response.Clear();
                Eyousoft_yhq.BLL.Product BLL = new Eyousoft_yhq.BLL.Product();
                if (doType == "add")
                {
                    result = BLL.Add(model);
                    msg    = result ? "添加成功!" : "添加失败!";
                    Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                }
                else
                {
                    model.ProductID = id;
                    result          = BLL.Update(model);
                    msg             = result ? "修改成功!" : "修改失败!";
                    Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                }
                Response.End();
            }
            else
            {
                msg = "产品名称包含敏感字符[" + IsContact + "],请修改后再保存!";
                Response.Clear();
                Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                Response.End();
            }
            #endregion
        }
Example #7
0
        protected void pageSave(string doType)
        {
            string id = Utils.GetQueryStringValue("id");
            var model = new Eyousoft_yhq.Model.Product();

            #region 实体赋值

            model.ProductName = Utils.GetFormValue(txtproductName.UniqueID);
            model.ProductType = Utils.GetInt(Utils.GetFormValue(ddltype.UniqueID));
            model.TourDate = Utils.GetDateTimeNullable(Utils.GetFormValue(txtsendDate.UniqueID));
            model.MarketPrice = Utils.GetDecimal(Utils.GetFormValue(txtmarkPrice.UniqueID));
            model.AppPrice = Utils.GetDecimal(Utils.GetFormValue(txtappPrice.UniqueID));
            model.LinkTel = Utils.GetFormValue(txttel.UniqueID);
            model.ProductDis = Utils.GetFormValue(txtdescript.UniqueID);
            model.TourDis = Utils.GetFormValue(txtjoury.UniqueID);
            model.SendTourKnow = Utils.GetFormValue(txtsendMark.UniqueID);
            model.Scompare = Utils.GetFormValue(txtScompare.UniqueID);
            model.ValidiDate = Utils.GetDateTime(Utils.GetFormValue(txtValidate.UniqueID));
            model.ProductState = 0;
            model.AttachList = NewGetAttach();
            model.IsEveryDay = Utils.GetFormValue("isEvery") == "1" ? true : false;
            model.IsHot = Utils.GetInt(Utils.GetFormValue(ddl_isHot.UniqueID));
            model.ServiceQQ = Utils.GetFormValue(txtkfqq.UniqueID);
            model.ContractType = (Model.ContractType)Utils.GetInt(Utils.GetFormValue(ddl_contact.UniqueID));
            model.ControlPeople = Utils.GetInt(Utils.GetFormValue(txtPeopleNum.UniqueID));

            model.ProductOpState = (Model.ProductOp)Utils.GetInt(Utils.GetFormValue(ddl_proType.UniqueID));
            model.ZCodeViaDate = Utils.GetDateTime(Utils.GetFormValue(txtZxingdate.UniqueID));
            model.PType = 1;
            model.ProductSdate = DateTime.Now;
            model.FavourCode = Utils.GetFormValue(txtWXcode.UniqueID);

            model.FaBuRenId = HuiYuanInfo.UserId;
            model.ShenHeStatus = Eyousoft_yhq.Model.ChanPinShenHeStatus.已审核;
            if (HuiYuanInfo.LeiXing == Eyousoft_yhq.Model.WebmasterLeiXing.供应商)
            {
                model.ShenHeStatus = Eyousoft_yhq.Model.ChanPinShenHeStatus.未审核;
            }
            #endregion

            if (new Eyousoft_yhq.BLL.Product().Exists(model))
            {
                Response.Clear();
                Response.Write(UtilsCommons.AjaxReturnJson("0", "此微信码已被使用"));
                Response.End();
            }

            cn.myvo.smc.Service sms = new cn.myvo.smc.Service();
            string IsContact = sms.IsIncludeKeyWord(model.ProductName);
            #region 提交保存
            bool result = false;
            string msg = "";

            if (string.IsNullOrEmpty(IsContact))
            {
                Response.Clear();
                Eyousoft_yhq.BLL.Product BLL = new Eyousoft_yhq.BLL.Product();
                if (doType == "add")
                {
                    result = BLL.Add(model);
                    msg = result ? "添加成功!" : "添加失败!";
                    Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                }
                else
                {
                    model.ProductID = id;
                    result = BLL.Update(model);
                    msg = result ? "修改成功!" : "修改失败!";
                    Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                }
                Response.End();
            }
            else
            {
                msg = "产品名称包含敏感字符[" + IsContact + "],请修改后再保存!";
                Response.Clear();
                Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                Response.End();
            }
            #endregion
        }
Example #8
0
        protected void pageSave(string doType)
        {
            string id    = Utils.GetQueryStringValue("id");
            var    model = new Eyousoft_yhq.Model.Product();

            #region 实体赋值

            model.ProductName   = Utils.GetFormValue(txtproductName.UniqueID);
            model.ProductType   = Utils.GetInt(Utils.GetFormValue(ddltype.UniqueID));
            model.TourDate      = Utils.GetDateTimeNullable(Utils.GetFormValue(txtsendDate.UniqueID));
            model.MarketPrice   = Utils.GetDecimal(Utils.GetFormValue(txtmarkPrice.UniqueID));
            model.AppPrice      = Utils.GetDecimal(Utils.GetFormValue(txtappPrice.UniqueID));
            model.LinkTel       = Utils.GetFormValue(txttel.UniqueID);
            model.ProductDis    = Utils.GetFormValue(txtdescript.UniqueID);
            model.TourDis       = Utils.GetFormValue(txtjoury.UniqueID);
            model.SendTourKnow  = Utils.GetFormValue(txtsendMark.UniqueID);
            model.Scompare      = Utils.GetFormValue(txtScompare.UniqueID);
            model.ValidiDate    = Utils.GetDateTime(Utils.GetFormValue(txtValidate.UniqueID));
            model.ProductState  = 0;
            model.AttachList    = NewGetAttach();
            model.IsEveryDay    = Utils.GetFormValue("isEvery") == "1" ? true : false;
            model.IsHot         = Utils.GetInt(Utils.GetFormValue(ddl_isHot.UniqueID));
            model.ServiceQQ     = Utils.GetFormValue(txtkfqq.UniqueID);
            model.ContractType  = (Model.ContractType)Utils.GetInt(Utils.GetFormValue(ddl_contact.UniqueID));
            model.ControlPeople = Utils.GetInt(Utils.GetFormValue(txtPeopleNum.UniqueID));

            model.ProductOpState = (Model.ProductOp)Utils.GetInt(Utils.GetFormValue(ddl_proType.UniqueID));
            model.ZCodeViaDate   = Utils.GetDateTime(Utils.GetFormValue(txtZxingdate.UniqueID));
            model.PType          = 1;
            model.ProductSdate   = DateTime.Now;
            model.FavourCode     = Utils.GetFormValue(txtWXcode.UniqueID);

            model.FaBuRenId    = HuiYuanInfo.UserId;
            model.ShenHeStatus = Eyousoft_yhq.Model.ChanPinShenHeStatus.已审核;
            if (HuiYuanInfo.LeiXing == Eyousoft_yhq.Model.WebmasterLeiXing.供应商)
            {
                model.ShenHeStatus = Eyousoft_yhq.Model.ChanPinShenHeStatus.未审核;
            }
            #endregion



            if (new Eyousoft_yhq.BLL.Product().Exists(model))
            {
                Response.Clear();
                Response.Write(UtilsCommons.AjaxReturnJson("0", "此微信码已被使用"));
                Response.End();
            }

            cn.myvo.smc.Service sms = new cn.myvo.smc.Service();
            string IsContact        = sms.IsIncludeKeyWord(model.ProductName);
            #region 提交保存
            bool   result = false;
            string msg    = "";

            if (string.IsNullOrEmpty(IsContact))
            {
                Response.Clear();
                Eyousoft_yhq.BLL.Product BLL = new Eyousoft_yhq.BLL.Product();
                if (doType == "add")
                {
                    result = BLL.Add(model);
                    msg    = result ? "添加成功!" : "添加失败!";
                    Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                }
                else
                {
                    model.ProductID = id;
                    result          = BLL.Update(model);
                    msg             = result ? "修改成功!" : "修改失败!";
                    Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                }
                Response.End();
            }
            else
            {
                msg = "产品名称包含敏感字符[" + IsContact + "],请修改后再保存!";
                Response.Clear();
                Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                Response.End();
            }
            #endregion
        }
Example #9
0
        protected void pageSave(string doType)
        {
            string id = Utils.GetQueryStringValue("id");
            var model = new Eyousoft_yhq.Model.Product();

            #region 实体赋值

            model.ProductName = Utils.GetFormValue(txtproductName.UniqueID);
            model.ProductType = 0;
            model.TourDate = Utils.GetDateTimeNullable(Utils.GetFormValue(txtsendDate.UniqueID));
            model.MarketPrice = Utils.GetDecimal(Utils.GetFormValue(txtmarkPrice.UniqueID));
            model.AppPrice = Utils.GetDecimal(Utils.GetFormValue(txtappPrice.UniqueID));
            //model.FavourCode = Utils.GetFormValue(txtcoupons.UniqueID);
            model.FavourCode = Utils.GetFormValue(txtWXcode.UniqueID);
            model.LinkTel = Utils.GetFormValue(txttel.UniqueID);
            model.ProductDis = Utils.GetFormValue(txtdescript.UniqueID);
            model.TourDis = Utils.GetFormValue(txtStation.UniqueID);
            model.SendTourKnow = Utils.GetFormValue(txtjoury.UniqueID);
            model.ValidiDate = Utils.GetDateTime(Utils.GetFormValue(txtValidate.UniqueID));
            model.ProductState = 0;
            model.AttachList = NewGetAttach();
            model.IsEveryDay = false;
            model.IsHot = 0;
            model.ServiceQQ = Utils.GetFormValue(txtkfqq.UniqueID);
            model.ContractType = Model.ContractType.车票;
            model.ControlPeople = Utils.GetInt(Utils.GetFormValue(txtPeopleNum.UniqueID));

            model.ProductSdate = Utils.GetDateTime(Utils.GetFormValue(txtsendsDate.UniqueID));
            model.ProductOpState = (Model.ProductOp)Utils.GetInt(Utils.GetFormValue(ddl_proType.UniqueID));
            model.ZCodeViaDate = Utils.GetDateTime(Utils.GetFormValue(txtZxingdate.UniqueID));
            model.PType = 2;
            #endregion

            cn.myvo.smc.Service sms = new cn.myvo.smc.Service();
            string IsContact = sms.IsIncludeKeyWord(model.ProductName);

            #region 提交保存
            bool result = false;
            string msg = "";

            if (string.IsNullOrEmpty(IsContact))
            {
                Response.Clear();
                Eyousoft_yhq.BLL.Product BLL = new Eyousoft_yhq.BLL.Product();
                if (doType == "add")
                {
                    result = BLL.Add(model);
                    msg = result ? "添加成功!" : "添加失败!";
                    Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                }
                else
                {
                    model.ProductID = id;
                    result = BLL.Update(model);
                    msg = result ? "修改成功!" : "修改失败!";
                    Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                }
                Response.End();
            }
            else
            {
                msg = "产品名称包含敏感字符[" + IsContact + "],请修改后再保存!";
                Response.Clear();
                Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg));
                Response.End();
            }
            #endregion
        }
Example #10
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="serModel"></param>
        /// <returns></returns>
        public IList <Eyousoft_yhq.Model.Product> GetList(Eyousoft_yhq.Model.SerProduct serModel)
        {
            IList <Eyousoft_yhq.Model.Product> list = new List <Eyousoft_yhq.Model.Product>();

            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ProductID,ProductName,ProductType,TourDate,MarketPrice,AppPrice,FavourCode,LinkTel,ProductDis,TourDis,SendTourKnow,ValidiDate,IsEveryDay,IsHot,CreateDate,ServiceQQ, ContractType,ControlPeople,ResidueNum,ProductOpState,ProductSdate,ZCodeViaDate,PType,XianLu   ");
            strSql.AppendFormat("  from view_Product where  1=1 and ProductState=0  AND datediff(day,'{0}',ValidiDate)>=0 ", DateTime.Now);
            if (serModel != null)
            {
                if (serModel.PType > 0)
                {
                    strSql.AppendFormat(" and  PType = {0} ", serModel.PType);
                }
                if (!string.IsNullOrEmpty(serModel.PurductName))
                {
                    strSql.AppendFormat(" and  ProductName like '%{0}%' ", serModel.PurductName);
                }
                if (!string.IsNullOrEmpty(serModel.FavourCode))
                {
                    strSql.AppendFormat(" and  FavourCode = '{0}' ", serModel.FavourCode);
                }
            }
            strSql.Append("  order by IsHot DESC, CreateDate  DESC  ");
            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());



            using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db))
            {
                while (dr.Read())
                {
                    Eyousoft_yhq.Model.Product model = new Eyousoft_yhq.Model.Product();
                    model.ProductID    = dr.GetString(dr.GetOrdinal("ProductID"));;
                    model.ProductName  = dr.GetString(dr.GetOrdinal("ProductName"));
                    model.ProductType  = dr.GetInt32(dr.GetOrdinal("ProductType"));
                    model.TourDate     = dr.IsDBNull(dr.GetOrdinal("TourDate")) ? null : Utils.GetDateTimeNullable(dr.GetDateTime(dr.GetOrdinal("TourDate")).ToString());
                    model.MarketPrice  = dr.GetDecimal(dr.GetOrdinal("MarketPrice"));
                    model.AppPrice     = dr.GetDecimal(dr.GetOrdinal("AppPrice"));
                    model.FavourCode   = dr.GetString(dr.GetOrdinal("FavourCode"));
                    model.LinkTel      = dr.GetString(dr.GetOrdinal("LinkTel"));
                    model.ProductDis   = dr.GetString(dr.GetOrdinal("ProductDis"));
                    model.TourDis      = dr.GetString(dr.GetOrdinal("TourDis"));
                    model.SendTourKnow = dr.GetString(dr.GetOrdinal("SendTourKnow"));
                    model.ValidiDate   = dr.GetDateTime(dr.GetOrdinal("ValidiDate"));
                    //model.ProductState = dr.GetInt32(dr.GetOrdinal("ProductState"));
                    model.IsEveryDay    = dr.IsDBNull(dr.GetOrdinal("IsEveryDay")) ? false : GetBoolean(dr.GetString(dr.GetOrdinal("IsEveryDay")));
                    model.IsHot         = dr.IsDBNull(dr.GetOrdinal("IsHot")) ? 0 : dr.GetByte(dr.GetOrdinal("IsHot"));
                    model.CreateDate    = dr.GetDateTime(dr.GetOrdinal("CreateDate"));
                    model.ServiceQQ     = dr.IsDBNull(dr.GetOrdinal("ServiceQQ")) ? "" : dr.GetString(dr.GetOrdinal("ServiceQQ"));
                    model.ContractType  = (Eyousoft_yhq.Model.ContractType)dr.GetByte(dr.GetOrdinal("ContractType"));
                    model.ControlPeople = dr.GetInt32(dr.GetOrdinal("ControlPeople"));
                    model.ResidueNum    = dr.GetInt32(dr.GetOrdinal("ResidueNum"));
                    model.ProductSdate  = dr.IsDBNull(dr.GetOrdinal("ProductSdate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ProductSdate"));
                    model.ZCodeViaDate  = dr.IsDBNull(dr.GetOrdinal("ZCodeViaDate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ZCodeViaDate"));
                    model.xianlu        = (Eyousoft_yhq.Model.XianLu)dr.GetByte(dr.GetOrdinal("XianLu"));

                    list.Add(model);
                }
            }
            return(list);
        }
Example #11
0
        public IList <Eyousoft_yhq.Model.Product> GetList(int PageSize, int PageIndex, ref int RecordCount, Eyousoft_yhq.Model.SerProduct serModel)
        {
            IList <Eyousoft_yhq.Model.Product> list = new List <Eyousoft_yhq.Model.Product>();


            string tableName     = "view_Product";
            string fileds        = " *  ";
            string orderByString = "";

            StringBuilder query = new StringBuilder();

            query.Append(" 1=1  ");

            if (serModel != null)
            {
                #region 排序
                if (serModel.SFTJ == 1)
                {
                    orderByString += " IsHot DESC,";
                }
                if (serModel.DDXL == 1)
                {
                    orderByString += "SaleNum DESC,";
                }
                if (serModel.DDXL == 2)
                {
                    orderByString += "SaleNum ASC,";
                }
                if (serModel.SJPX == 1)
                {
                    orderByString += "CreateDate DESC,";
                }
                else if (serModel.SJPX == 2)
                {
                    orderByString += "CreateDate  ASC,";
                }

                if (serModel.JGPX == 1)
                {
                    orderByString += "AppPrice DESC,";
                }
                if (serModel.JGPX == 2)
                {
                    orderByString += "AppPrice ASC,";
                }

                if (!string.IsNullOrEmpty(orderByString))
                {
                    orderByString = orderByString.TrimEnd(',');
                }
                else
                {
                    orderByString = "IsHot DESC,CreateDate desc";
                }
                #endregion

                if (!string.IsNullOrEmpty(serModel.FavourCode))
                {
                    query.AppendFormat(" and  (FavourCode = '{0}' )", serModel.FavourCode);
                }
                if (serModel.PType > 0)
                {
                    query.AppendFormat(" and  (PType = {0} )", serModel.PType);
                }

                if (serModel.IsAdmin != "1" && !string.IsNullOrEmpty(serModel.AdminName))
                {
                    query.AppendFormat(" and (  charindex('{0}',[AdminName])>0 or  AdminName is null)", serModel.AdminName);
                }

                if (!string.IsNullOrEmpty(serModel.PurductName))
                {
                    query.AppendFormat(" and  ProductName like '%{0}%' ", serModel.PurductName);
                }

                if (!string.IsNullOrEmpty(serModel.PurductType) && serModel.PurductType != "0")
                {
                    query.AppendFormat(" and  ProductType = '{0}' ", serModel.PurductType);
                }
                if (!string.IsNullOrEmpty(serModel.PurductState) && serModel.PurductState != "2")
                {
                    query.AppendFormat(" and  ProductState = '{0}' ", serModel.PurductState);
                }
                if (serModel.Stime.HasValue)
                {
                    query.AppendFormat(" AND datediff(day,'{0}',ValidiDate)>=0 ", serModel.Stime.Value);
                }
                if (serModel.Etime.HasValue)
                {
                    query.AppendFormat(" AND datediff(day,'{0}',ValidiDate)< 0 ", serModel.Etime.Value.AddDays(1));
                }
                if (!serModel.isVisable)
                {
                    query.AppendFormat(" AND ProductState = 0 ");
                }
                if (serModel.isHot.HasValue && serModel.isHot == 1)
                {
                    query.AppendFormat(" and  IsHot = '{0}' ", serModel.isHot);
                }
                else if (serModel.isHot.HasValue && serModel.isHot == 0)
                {
                    query.AppendFormat(" and  (IsHot = '{0}'  or IsHot is null) ", serModel.isHot);
                }

                if (serModel.xianlu != null && serModel.PType == 1)
                {
                    query.AppendFormat(" and  XianLu = '{0}' ", (int)serModel.xianlu);
                }

                if (!string.IsNullOrEmpty(serModel.WeiDianId))
                {
                    query.AppendFormat(" AND EXISTS(SELECT 1 FROM tbl_WeiDianChanPinGuanXi AS A1 WHERE A1.ChanPinId=view_Product.ProductID AND A1.WeiDianId='{0}') ", serModel.WeiDianId);
                }

                if (!string.IsNullOrEmpty(serModel.FaBuRenId))
                {
                    query.AppendFormat(" AND FaBuRenId='{0}' ", serModel.FaBuRenId);
                }
                if (serModel.ShenHeStatus.HasValue)
                {
                    query.AppendFormat(" AND ShenHeStatus={0} ", (int)serModel.ShenHeStatus.Value);
                }
            }
            else
            {
                orderByString = "IsHot DESC,CreateDate desc";
            }

            using (IDataReader dr = DbHelper.ExecuteReader1(this._db, PageSize, PageIndex, ref RecordCount, tableName, fileds, query.ToString(), orderByString, null))
            {
                while (dr.Read())
                {
                    Eyousoft_yhq.Model.Product model = new Eyousoft_yhq.Model.Product();
                    model.ProductID      = dr.GetString(dr.GetOrdinal("ProductID"));;
                    model.ProductName    = dr.GetString(dr.GetOrdinal("ProductName"));
                    model.ProductType    = dr.GetInt32(dr.GetOrdinal("ProductType"));
                    model.TourDate       = dr.IsDBNull(dr.GetOrdinal("TourDate")) ? null : Utils.GetDateTimeNullable(dr.GetDateTime(dr.GetOrdinal("TourDate")).ToString());
                    model.MarketPrice    = dr.GetDecimal(dr.GetOrdinal("MarketPrice"));
                    model.AppPrice       = dr.GetDecimal(dr.GetOrdinal("AppPrice"));
                    model.FavourCode     = dr.GetString(dr.GetOrdinal("FavourCode"));
                    model.LinkTel        = dr.GetString(dr.GetOrdinal("LinkTel"));
                    model.ProductDis     = dr.GetString(dr.GetOrdinal("ProductDis"));
                    model.TourDis        = dr.GetString(dr.GetOrdinal("TourDis"));
                    model.SendTourKnow   = dr.GetString(dr.GetOrdinal("SendTourKnow"));
                    model.ValidiDate     = dr.GetDateTime(dr.GetOrdinal("ValidiDate"));
                    model.ProductState   = dr.GetByte(dr.GetOrdinal("ProductState"));
                    model.IsEveryDay     = dr.IsDBNull(dr.GetOrdinal("IsEveryDay")) ? false : GetBoolean(dr.GetString(dr.GetOrdinal("IsEveryDay")));
                    model.IsHot          = dr.IsDBNull(dr.GetOrdinal("IsHot")) ? 0 : dr.GetByte(dr.GetOrdinal("IsHot"));
                    model.CreateDate     = dr.GetDateTime(dr.GetOrdinal("CreateDate"));
                    model.ServiceQQ      = dr.IsDBNull(dr.GetOrdinal("ServiceQQ")) ? "" : dr.GetString(dr.GetOrdinal("ServiceQQ"));
                    model.ContractType   = (Eyousoft_yhq.Model.ContractType)dr.GetByte(dr.GetOrdinal("ContractType"));
                    model.ControlPeople  = dr.GetInt32(dr.GetOrdinal("ControlPeople"));
                    model.ResidueNum     = dr.GetInt32(dr.GetOrdinal("ResidueNum"));
                    model.SaleNum        = dr.GetInt32(dr.GetOrdinal("SaleNum"));
                    model.ProductOpState = (Eyousoft_yhq.Model.ProductOp)dr.GetByte(dr.GetOrdinal("ProductOpState"));
                    model.ProductSdate   = dr.IsDBNull(dr.GetOrdinal("ProductSdate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ProductSdate"));
                    model.ZCodeViaDate   = dr.IsDBNull(dr.GetOrdinal("ZCodeViaDate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ZCodeViaDate"));
                    model.PType          = dr.IsDBNull(dr.GetOrdinal("PType")) ? 1 : dr.GetInt32(dr.GetOrdinal("PType"));
                    model.xianlu         = dr.IsDBNull(dr.GetOrdinal("XianLu")) ? Eyousoft_yhq.Model.XianLu.国内游 : (Eyousoft_yhq.Model.XianLu)dr.GetByte(dr.GetOrdinal("XianLu"));
                    model.FaBuRenId      = dr["FaBuRenId"].ToString();
                    model.ShenHeStatus   = (Eyousoft_yhq.Model.ChanPinShenHeStatus)dr.GetInt32(dr.GetOrdinal("ShenHeStatus"));
                    model.FaBuRenName    = dr["FaBuRenName"].ToString();

                    list.Add(model);
                }
            }
            return(list);
        }
Example #12
0
        public Eyousoft_yhq.Model.Product GetModel(string ProductID)
        {
            Eyousoft_yhq.Model.Product model = null;

            StringBuilder strSql = new StringBuilder();
            strSql.AppendFormat("SELECT *,");

            strSql.AppendFormat(" (SELECT Name,FilePath,Size,IsWebImage  FROM tbl_Attach WHERE   ItemId='{0}' FOR XML RAW,ROOT('ROOT'))AS ComAttachXML   ", ProductID);

            strSql.Append("  FROM view_Product   ");
            strSql.Append(" where ProductID=@ProductID ");
            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());
            this._db.AddInParameter(cmd, "ProductID", System.Data.DbType.AnsiStringFixedLength, ProductID);

            using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db))
            {
                while (dr.Read())
                {
                    model = new Eyousoft_yhq.Model.Product();
                    model.ProductID = ProductID;
                    model.ProductName = dr.GetString(dr.GetOrdinal("ProductName"));
                    model.ProductType = dr.GetInt32(dr.GetOrdinal("ProductType"));
                    model.TourDate = dr.IsDBNull(dr.GetOrdinal("TourDate")) ? null : Utils.GetDateTimeNullable(dr.GetDateTime(dr.GetOrdinal("TourDate")).ToString());
                    model.MarketPrice = dr.GetDecimal(dr.GetOrdinal("MarketPrice"));
                    model.AppPrice = dr.GetDecimal(dr.GetOrdinal("AppPrice"));
                    model.FavourCode = dr.GetString(dr.GetOrdinal("FavourCode"));
                    model.LinkTel = dr.GetString(dr.GetOrdinal("LinkTel"));
                    model.ProductDis = dr.GetString(dr.GetOrdinal("ProductDis"));
                    model.TourDis = dr.GetString(dr.GetOrdinal("TourDis"));
                    model.SendTourKnow = dr.GetString(dr.GetOrdinal("SendTourKnow"));
                    model.ValidiDate = dr.GetDateTime(dr.GetOrdinal("ValidiDate"));
                    //model.ProductState = dr.GetInt32(dr.GetOrdinal("ProductState"));
                    model.AttachList = this.GetAttachList(dr["ComAttachXML"].ToString(), ProductID);
                    model.IsEveryDay = dr.IsDBNull(dr.GetOrdinal("IsEveryDay")) ? false : GetBoolean(dr.GetString(dr.GetOrdinal("IsEveryDay")));
                    model.IsHot = dr.IsDBNull(dr.GetOrdinal("IsHot")) ? 0 : dr.GetByte(dr.GetOrdinal("IsHot"));
                    model.ServiceQQ = dr.IsDBNull(dr.GetOrdinal("ServiceQQ")) ? "" : dr.GetString(dr.GetOrdinal("ServiceQQ"));
                    model.ContractType = (Eyousoft_yhq.Model.ContractType)dr.GetByte(dr.GetOrdinal("ContractType"));
                    model.ControlPeople = dr.GetInt32(dr.GetOrdinal("ControlPeople"));
                    model.ResidueNum = dr.GetInt32(dr.GetOrdinal("ResidueNum"));
                    model.SaleNum = dr.GetInt32(dr.GetOrdinal("SaleNum"));
                    model.ProductOpState = (Eyousoft_yhq.Model.ProductOp)dr.GetByte(dr.GetOrdinal("ProductOpState"));
                    model.ProductSdate = dr.IsDBNull(dr.GetOrdinal("ProductSdate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ProductSdate"));
                    model.ZCodeViaDate = dr.IsDBNull(dr.GetOrdinal("ZCodeViaDate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ZCodeViaDate"));
                    model.PType = dr.IsDBNull(dr.GetOrdinal("PType")) ? 1 : dr.GetInt32(dr.GetOrdinal("PType"));
                    model.Scompare = dr.IsDBNull(dr.GetOrdinal("Scompare")) ? "" : dr.GetString(dr.GetOrdinal("Scompare"));
                    model.FaBuRenId = dr["FaBuRenId"].ToString();
                    model.ShenHeStatus = (Eyousoft_yhq.Model.ChanPinShenHeStatus)dr.GetInt32(dr.GetOrdinal("ShenHeStatus"));
                }
            }

            return model;
        }
Example #13
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="serModel"></param>
        /// <returns></returns>
        public IList<Eyousoft_yhq.Model.Product> GetList(Eyousoft_yhq.Model.SerProduct serModel)
        {
            IList<Eyousoft_yhq.Model.Product> list = new List<Eyousoft_yhq.Model.Product>();

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ProductID,ProductName,ProductType,TourDate,MarketPrice,AppPrice,FavourCode,LinkTel,ProductDis,TourDis,SendTourKnow,ValidiDate,IsEveryDay,IsHot,CreateDate,ServiceQQ, ContractType,ControlPeople,ResidueNum,ProductOpState,ProductSdate,ZCodeViaDate,PType,XianLu   ");
            strSql.AppendFormat("  from view_Product where  1=1 and ProductState=0  AND datediff(day,'{0}',ValidiDate)>=0 ", DateTime.Now);
            if (serModel != null)
            {
                if (serModel.PType > 0)
                {
                    strSql.AppendFormat(" and  PType = {0} ", serModel.PType);
                }
                if (!string.IsNullOrEmpty(serModel.PurductName))
                {
                    strSql.AppendFormat(" and  ProductName like '%{0}%' ", serModel.PurductName);
                }
                if (!string.IsNullOrEmpty(serModel.FavourCode))
                {
                    strSql.AppendFormat(" and  FavourCode = '{0}' ", serModel.FavourCode);
                }
            }
            strSql.Append("  order by IsHot DESC, CreateDate  DESC  ");
            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());

            using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db))
            {
                while (dr.Read())
                {

                    Eyousoft_yhq.Model.Product model = new Eyousoft_yhq.Model.Product();
                    model.ProductID = dr.GetString(dr.GetOrdinal("ProductID")); ;
                    model.ProductName = dr.GetString(dr.GetOrdinal("ProductName"));
                    model.ProductType = dr.GetInt32(dr.GetOrdinal("ProductType"));
                    model.TourDate = dr.IsDBNull(dr.GetOrdinal("TourDate")) ? null : Utils.GetDateTimeNullable(dr.GetDateTime(dr.GetOrdinal("TourDate")).ToString());
                    model.MarketPrice = dr.GetDecimal(dr.GetOrdinal("MarketPrice"));
                    model.AppPrice = dr.GetDecimal(dr.GetOrdinal("AppPrice"));
                    model.FavourCode = dr.GetString(dr.GetOrdinal("FavourCode"));
                    model.LinkTel = dr.GetString(dr.GetOrdinal("LinkTel"));
                    model.ProductDis = dr.GetString(dr.GetOrdinal("ProductDis"));
                    model.TourDis = dr.GetString(dr.GetOrdinal("TourDis"));
                    model.SendTourKnow = dr.GetString(dr.GetOrdinal("SendTourKnow"));
                    model.ValidiDate = dr.GetDateTime(dr.GetOrdinal("ValidiDate"));
                    //model.ProductState = dr.GetInt32(dr.GetOrdinal("ProductState"));
                    model.IsEveryDay = dr.IsDBNull(dr.GetOrdinal("IsEveryDay")) ? false : GetBoolean(dr.GetString(dr.GetOrdinal("IsEveryDay")));
                    model.IsHot = dr.IsDBNull(dr.GetOrdinal("IsHot")) ? 0 : dr.GetByte(dr.GetOrdinal("IsHot"));
                    model.CreateDate = dr.GetDateTime(dr.GetOrdinal("CreateDate"));
                    model.ServiceQQ = dr.IsDBNull(dr.GetOrdinal("ServiceQQ")) ? "" : dr.GetString(dr.GetOrdinal("ServiceQQ"));
                    model.ContractType = (Eyousoft_yhq.Model.ContractType)dr.GetByte(dr.GetOrdinal("ContractType"));
                    model.ControlPeople = dr.GetInt32(dr.GetOrdinal("ControlPeople"));
                    model.ResidueNum = dr.GetInt32(dr.GetOrdinal("ResidueNum"));
                    model.ProductSdate = dr.IsDBNull(dr.GetOrdinal("ProductSdate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ProductSdate"));
                    model.ZCodeViaDate = dr.IsDBNull(dr.GetOrdinal("ZCodeViaDate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ZCodeViaDate"));
                    model.xianlu = (Eyousoft_yhq.Model.XianLu)dr.GetByte(dr.GetOrdinal("XianLu"));

                    list.Add(model);
                }
            }
            return list;
        }
Example #14
0
        public IList<Eyousoft_yhq.Model.Product> GetList(int PageSize, int PageIndex, ref int RecordCount, Eyousoft_yhq.Model.SerProduct serModel)
        {
            IList<Eyousoft_yhq.Model.Product> list = new List<Eyousoft_yhq.Model.Product>();

            string tableName = "view_Product";
            string fileds = " *  ";
            string orderByString = "";

            StringBuilder query = new StringBuilder();
            query.Append(" 1=1  ");

            if (serModel != null)
            {
                #region 排序
                if (serModel.SFTJ == 1) orderByString += " IsHot DESC,";
                if (serModel.DDXL == 1) orderByString += "SaleNum DESC,";
                if (serModel.DDXL == 2) orderByString += "SaleNum ASC,";
                if (serModel.SJPX == 1)
                {
                    orderByString += "CreateDate DESC,";
                }
                else if (serModel.SJPX == 2)
                {
                    orderByString += "CreateDate  ASC,";
                }

                if (serModel.JGPX == 1) orderByString += "AppPrice DESC,";
                if (serModel.JGPX == 2) orderByString += "AppPrice ASC,";

                if (!string.IsNullOrEmpty(orderByString))
                {
                    orderByString = orderByString.TrimEnd(',');
                }
                else
                {
                    orderByString = "IsHot DESC,CreateDate desc";
                }
                #endregion

                if (!string.IsNullOrEmpty(serModel.FavourCode))
                {
                    query.AppendFormat(" and  (FavourCode = '{0}' )", serModel.FavourCode);
                }
                if (serModel.PType > 0)
                {
                    query.AppendFormat(" and  (PType = {0} )", serModel.PType);
                }

                if (serModel.IsAdmin != "1" && !string.IsNullOrEmpty(serModel.AdminName))
                {
                    query.AppendFormat(" and (  charindex('{0}',[AdminName])>0 or  AdminName is null)", serModel.AdminName);
                }

                if (!string.IsNullOrEmpty(serModel.PurductName))
                {
                    query.AppendFormat(" and  ProductName like '%{0}%' ", serModel.PurductName);
                }

                if (!string.IsNullOrEmpty(serModel.PurductType) && serModel.PurductType != "0")
                {
                    query.AppendFormat(" and  ProductType = '{0}' ", serModel.PurductType);
                }
                if (!string.IsNullOrEmpty(serModel.PurductState) && serModel.PurductState != "2")
                {
                    query.AppendFormat(" and  ProductState = '{0}' ", serModel.PurductState);
                }
                if (serModel.Stime.HasValue)
                {
                    query.AppendFormat(" AND datediff(day,'{0}',ValidiDate)>=0 ", serModel.Stime.Value);
                }
                if (serModel.Etime.HasValue)
                {
                    query.AppendFormat(" AND datediff(day,'{0}',ValidiDate)< 0 ", serModel.Etime.Value.AddDays(1));
                }
                if (!serModel.isVisable)
                {
                    query.AppendFormat(" AND ProductState = 0 ");
                }
                if (serModel.isHot.HasValue && serModel.isHot == 1)
                {
                    query.AppendFormat(" and  IsHot = '{0}' ", serModel.isHot);
                }
                else if (serModel.isHot.HasValue && serModel.isHot == 0)
                {
                    query.AppendFormat(" and  (IsHot = '{0}'  or IsHot is null) ", serModel.isHot);
                }

                if (serModel.xianlu != null && serModel.PType == 1)
                {
                    query.AppendFormat(" and  XianLu = '{0}' ", (int)serModel.xianlu);
                }

                if (!string.IsNullOrEmpty(serModel.WeiDianId))
                {
                    query.AppendFormat(" AND EXISTS(SELECT 1 FROM tbl_WeiDianChanPinGuanXi AS A1 WHERE A1.ChanPinId=view_Product.ProductID AND A1.WeiDianId='{0}') ", serModel.WeiDianId);
                }

                if (!string.IsNullOrEmpty(serModel.FaBuRenId))
                {
                    query.AppendFormat(" AND FaBuRenId='{0}' ", serModel.FaBuRenId);
                }
                if (serModel.ShenHeStatus.HasValue)
                {
                    query.AppendFormat(" AND ShenHeStatus={0} ", (int)serModel.ShenHeStatus.Value);
                }
            }
            else
            {
                orderByString = "IsHot DESC,CreateDate desc";
            }

            using (IDataReader dr = DbHelper.ExecuteReader1(this._db, PageSize, PageIndex, ref RecordCount, tableName, fileds, query.ToString(), orderByString, null))
            {
                while (dr.Read())
                {

                    Eyousoft_yhq.Model.Product model = new Eyousoft_yhq.Model.Product();
                    model.ProductID = dr.GetString(dr.GetOrdinal("ProductID")); ;
                    model.ProductName = dr.GetString(dr.GetOrdinal("ProductName"));
                    model.ProductType = dr.GetInt32(dr.GetOrdinal("ProductType"));
                    model.TourDate = dr.IsDBNull(dr.GetOrdinal("TourDate")) ? null : Utils.GetDateTimeNullable(dr.GetDateTime(dr.GetOrdinal("TourDate")).ToString());
                    model.MarketPrice = dr.GetDecimal(dr.GetOrdinal("MarketPrice"));
                    model.AppPrice = dr.GetDecimal(dr.GetOrdinal("AppPrice"));
                    model.FavourCode = dr.GetString(dr.GetOrdinal("FavourCode"));
                    model.LinkTel = dr.GetString(dr.GetOrdinal("LinkTel"));
                    model.ProductDis = dr.GetString(dr.GetOrdinal("ProductDis"));
                    model.TourDis = dr.GetString(dr.GetOrdinal("TourDis"));
                    model.SendTourKnow = dr.GetString(dr.GetOrdinal("SendTourKnow"));
                    model.ValidiDate = dr.GetDateTime(dr.GetOrdinal("ValidiDate"));
                    model.ProductState = dr.GetByte(dr.GetOrdinal("ProductState"));
                    model.IsEveryDay = dr.IsDBNull(dr.GetOrdinal("IsEveryDay")) ? false : GetBoolean(dr.GetString(dr.GetOrdinal("IsEveryDay")));
                    model.IsHot = dr.IsDBNull(dr.GetOrdinal("IsHot")) ? 0 : dr.GetByte(dr.GetOrdinal("IsHot"));
                    model.CreateDate = dr.GetDateTime(dr.GetOrdinal("CreateDate"));
                    model.ServiceQQ = dr.IsDBNull(dr.GetOrdinal("ServiceQQ")) ? "" : dr.GetString(dr.GetOrdinal("ServiceQQ"));
                    model.ContractType = (Eyousoft_yhq.Model.ContractType)dr.GetByte(dr.GetOrdinal("ContractType"));
                    model.ControlPeople = dr.GetInt32(dr.GetOrdinal("ControlPeople"));
                    model.ResidueNum = dr.GetInt32(dr.GetOrdinal("ResidueNum"));
                    model.SaleNum = dr.GetInt32(dr.GetOrdinal("SaleNum"));
                    model.ProductOpState = (Eyousoft_yhq.Model.ProductOp)dr.GetByte(dr.GetOrdinal("ProductOpState"));
                    model.ProductSdate = dr.IsDBNull(dr.GetOrdinal("ProductSdate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ProductSdate"));
                    model.ZCodeViaDate = dr.IsDBNull(dr.GetOrdinal("ZCodeViaDate")) ? DateTime.Now : dr.GetDateTime(dr.GetOrdinal("ZCodeViaDate"));
                    model.PType = dr.IsDBNull(dr.GetOrdinal("PType")) ? 1 : dr.GetInt32(dr.GetOrdinal("PType"));
                    model.xianlu = dr.IsDBNull(dr.GetOrdinal("XianLu")) ? Eyousoft_yhq.Model.XianLu.国内游 : (Eyousoft_yhq.Model.XianLu)dr.GetByte(dr.GetOrdinal("XianLu"));
                    model.FaBuRenId = dr["FaBuRenId"].ToString();
                    model.ShenHeStatus = (Eyousoft_yhq.Model.ChanPinShenHeStatus)dr.GetInt32(dr.GetOrdinal("ShenHeStatus"));
                    model.FaBuRenName = dr["FaBuRenName"].ToString();

                    list.Add(model);
                }
            }
            return list;
        }