private void SetPage(string discode)
        {
            TB_DishEntity disEntity = bll.GetEntitySigInfo("DisCode='" + discode + "'");

            if (disEntity != null && !string.IsNullOrWhiteSpace(disEntity.DisCode))
            {
                ddlStore.SelectedValue = disEntity.StoCode;
                txt_disname.Value      = disEntity.DisName;
                txt_disothername.Value = disEntity.OtherName;
                txt_quickcode.Value    = disEntity.QuickCode;
                txt_selunit.Value      = disEntity.Unit;
                txt_price.Value        = disEntity.Price.ToString("f2");
                txt_costprice.Value    = disEntity.CostPrice.ToString("f2");
                txt_remark.Value       = disEntity.Descript;
                TB_DishTypeEntity typeEntity = new bllTB_DishType().GetEntitySigInfo(" PKCode='" + disEntity.TypeCode + "' ");
                if (typeEntity != null && !string.IsNullOrWhiteSpace(typeEntity.PKCode))
                {
                    ddl_selDisheType.SelectedValue = typeEntity.PKKCode;
                    ddl_selDisheType_SelectedIndexChanged(null, null);
                    ddl_sel_dishetypetwo.SelectedValue = disEntity.TypeCode;
                }
            }
            DataTable dtImage = new bllPaging().GetPagingInfo("TR_DishImage", "id", "*", int.MaxValue, 1, "discode='" + discode + "'", "", "", out int recnums, out int pagenums);

            if (dtImage != null)
            {
                string imageHtml = "";
                foreach (DataRow dr in dtImage.Rows)
                {
                    imageHtml += "<img  imgindex=\"\"  width=\"200\" height=\"200\" style=\"float: left; margin - left:6px; \" src=\"/UploadFiles" + dr["ImgUrl"] + "\" onclick=\"deleteimage(this, '')\" />";
                }
                HidImagesHtml.Value = imageHtml;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(string GUID, string UID, TB_DishEntity UEntity)
        {
            //更新数据
            int result = dal.Update(UEntity);

            CheckResult(result, "");
        }
        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="dicPar"></param>
        private void UpdateStatus(Dictionary <string, object> dicPar)
        {
            ///要检测的参数信息
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID", "id", "status"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            //获取参数信息
            string        GUID    = dicPar["GUID"].ToString();
            string        USER_ID = dicPar["USER_ID"].ToString();
            string        ids     = dicPar["id"].ToString();
            string        status  = dicPar["status"].ToString();
            string        DisCode = dicPar["id"].ToString().Trim(',');
            TB_DishEntity UEntity = bll.GetEntitySigInfo("Where DisCode='" + DisCode + "'");

            UEntity.TStatus = status;

            bll.Update(GUID, USER_ID, UEntity);
            ReturnResultJson(bll.oResult.Code, bll.oResult.Msg);
        }
Beispiel #4
0
        /// <summary>
        /// 检验表单数据
        /// </summary>
        /// <returns></returns>
        public bool CheckPageInfo(string type, string Images, string StoCode, string TStatus, string DisName, string OtherName, string TypeCode, string QuickCode, string Unit, string Price, string CostPrice, string Descript)
        {
            bool rel = false;

            try
            {
                Entity           = new TB_DishEntity();
                Entity.Id        = 0;
                Entity.ImageName = Images;
                Entity.StoCode   = StoCode;
                Entity.TStatus   = TStatus;
                Entity.DisName   = DisName;
                Entity.OtherName = OtherName;
                Entity.TypeCode  = TypeCode;
                Entity.QuickCode = QuickCode;
                Entity.Unit      = Unit;
                Entity.Price     = StringHelper.StringToDecimal(Price);
                Entity.CostPrice = StringHelper.StringToDecimal(CostPrice);
                Entity.Descript  = Descript;
                rel = true;
            }
            catch (Exception)
            {
            }
            return(rel);
        }
        //private void Add(Dictionary<string, object> dicPar)
        //{
        //    //要检测的参数信息
        //    List<string> pra = new List<string>() { "GUID", "USER_ID", "userid", "BusCode", "StoCode", "CCname", "UCname", "TStatus", "ChannelCodeList", "DisCode", "DisName", "OtherName", "TypeCode", "QuickCode", "CusDisCode", "Unit", "Price", "MenuCode", "MemPrice", "CostPrice", "RoyMoney", "ExtCode", "FinCode", "KitCode", "CookerCode", "MakeTime", "QRCode", "WarCode", "MatCode", "Descript", "IsCount", "DefCount", "CountPrice", "IsVarPrice", "IsWeight", "IsMethod", "IsStock", "IsPoint", "IsMemPrice", "IsCoupon", "IsKeep", "IsCombo", "CCode", "UCode", "ImageName", "dishesMethodsJson", "dishescombosJson", "dishescomboinfoJson" };
        //    //检测方法需要的参数
        //    if (!CheckActionParameters(dicPar, pra))
        //    {
        //        return;
        //    }
        //    //获取参数信息
        //    string userid = dicPar["userid"].ToString();
        //    string GUID = dicPar["GUID"].ToString();
        //    string USER_ID = dicPar["USER_ID"].ToString();
        //    string BusCode = dicPar["BusCode"].ToString();
        //    string StoCode = dicPar["StoCode"].ToString();
        //    string TStatus = dicPar["TStatus"].ToString();
        //    string ChannelCodeList = "";
        //    string DisCode = dicPar["DisCode"].ToString();
        //    string DisName = dicPar["DisName"].ToString();
        //    string OtherName = dicPar["OtherName"].ToString();
        //    string TypeCode = dicPar["TypeCode"].ToString();
        //    string QuickCode = dicPar["QuickCode"].ToString();
        //    string Unit = dicPar["Unit"].ToString();
        //    string Price = dicPar["Price"].ToString();
        //    string CostPrice = dicPar["CostPrice"].ToString();
        //    string QRCode = dicPar["QRCode"].ToString();
        //    string Descript = dicPar["Descript"].ToString();
        //    if (string.IsNullOrEmpty(QuickCode))
        //    {
        //        QuickCode = StringHelper.GetChineseSpell(DisName);
        //    }
        //    //调用逻辑
        //    bll.Add( GUID, USER_ID,  BusCode,  StoCode,  TStatus,  ChannelCodeList,  DisCode,  DisName,  OtherName,  TypeCode,  QuickCode,  Unit,  Price,  CostPrice,  QRCode,  Descript);
        //    ReturnResultJson(bll.oResult.Code, bll.oResult.Msg);
        //}

        private void Update(Dictionary <string, object> dicPar)
        {
            //要检测的参数信息
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID", "userid", "BusCode", "StoCode", "CCname", "UCname", "TStatus", "ChannelCodeList", "DisCode", "DisName", "OtherName", "TypeCode", "QuickCode", "CusDisCode", "Unit", "Price", "MenuCode", "MemPrice", "CostPrice", "RoyMoney", "ExtCode", "FinCode", "KitCode", "CookerCode", "MakeTime", "QRCode", "WarCode", "MatCode", "Descript", "IsCount", "DefCount", "CountPrice", "IsVarPrice", "IsWeight", "IsMethod", "IsStock", "IsPoint", "IsMemPrice", "IsCoupon", "IsKeep", "IsCombo", "CCode", "UCode", "ImageName", "dishesMethodsJson", "dishescombosJson", "dishescomboinfoJson"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            //获取参数信息
            string userid          = dicPar["userid"].ToString();
            string GUID            = dicPar["GUID"].ToString();
            string USER_ID         = dicPar["USER_ID"].ToString();
            string StoCode         = dicPar["StoCode"].ToString();
            string ChannelCodeList = "";
            string DisCode         = dicPar["DisCode"].ToString();
            string DisName         = dicPar["DisName"].ToString();
            string OtherName       = dicPar["OtherName"].ToString();
            string QuickCode       = dicPar["QuickCode"].ToString();
            string Unit            = dicPar["Unit"].ToString();
            string Price           = dicPar["Price"].ToString();
            string CostPrice       = dicPar["CostPrice"].ToString();
            string QRCode          = dicPar["QRCode"].ToString();
            string Descript        = dicPar["Descript"].ToString();


            if (string.IsNullOrEmpty(QuickCode))
            {
                QuickCode = StringHelper.GetChineseSpell(DisName);
            }

            //调用逻辑
            TB_DishEntity UEntity = bll.GetEntitySigInfo("Where DisCode='" + DisCode + "' and Stocode='" + StoCode + "'");

            UEntity.ChannelCodeList = ChannelCodeList;
            UEntity.CostPrice       = StringHelper.StringToDecimal(CostPrice);
            UEntity.Descript        = Descript;
            UEntity.DisName         = DisName;
            UEntity.OtherName       = OtherName;
            UEntity.Price           = StringHelper.StringToDecimal(Price);
            UEntity.QRCode          = QRCode;
            UEntity.QuickCode       = QuickCode;
            UEntity.Unit            = Unit;

            bll.Update(GUID, USER_ID, UEntity);

            ReturnResultJson(bll.oResult.Code, bll.oResult.Msg);
        }
        /// <summary>
        /// 保存菜品信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Save_btn_Click(object sender, EventArgs e)
        {
            string StoCode         = ddlStore.SelectedValue;
            string ChannelCodeList = "";
            string disname         = txt_disname.Value;
            string OtherName       = txt_disothername.Value;
            string typecode        = ddl_sel_dishetypetwo.SelectedValue;
            string QuickCode       = txt_quickcode.Value;
            string UnitName        = txt_selunit.Value;
            string price           = txt_price.Value;
            string costprice       = txt_costprice.Value;
            string Descript        = txt_remark.Value;
            string imagename       = hidimages.Value;

            if (hidid.Value.Length == 0 || hidid.Value == "0")//添加信息
            {
                bll.Add("", "", imagename, StoCode, "1", disname, OtherName, typecode, QuickCode, UnitName, price, costprice, Descript);
                hidid.Value = bll.oResult.Data;
                if (bll.oResult.Code == "1")
                {
                    //添加图片
                }
                this.PageTitle.Operate = "修改";
            }
            else//修改信息
            {
                TB_DishEntity UEntity = bll.GetEntitySigInfo(" discode='" + hidid.Value + "'");
                UEntity.StoCode         = StoCode;
                UEntity.ChannelCodeList = ChannelCodeList;
                UEntity.DisName         = disname;
                UEntity.OtherName       = OtherName;
                UEntity.TypeCode        = typecode;
                UEntity.QuickCode       = QuickCode;
                UEntity.Unit            = UnitName;
                UEntity.ImageName       = imagename;
                UEntity.Price           = StringHelper.StringToDecimal(price);
                UEntity.CostPrice       = StringHelper.StringToDecimal(costprice);
                bll.Update("0", "0", UEntity);
            }
            //显示结果
            ShowResult(bll.oResult.Code, bll.oResult.Msg, errormessage);
        }
Beispiel #7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(TB_DishEntity Entity)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append(" declare @ID int;");
            sql.Append(" declare @returnval int;");
            sql.Append(" set @returnval=0;");
            sql.Append(" declare @DisCode varchar(32);");
            sql.Append(" set @DisCode='" + Entity.DisCode + "';");
            sql.Append("declare @DisMethodCode varchar(32)");
            sql.Append(" if not exists(select 1 from TB_Dish where StoCode='" + Entity.StoCode + "' and DisCode='" + Entity.DisCode + "')  set @returnval=2;  ");
            sql.Append(" if exists(select 1 from TB_Dish where StoCode='" + Entity.StoCode + "' and DisCode<>'" + Entity.DisCode + "'  and ((QRCode='" + Entity.QRCode + "' and '" + Entity.QRCode + "'<>'') or DisName='" + Entity.DisName + "'))  set @returnval=7;  ");
            sql.Append(" if @returnval=0 begin");

            string InsertSql = "[StoCode] ='{0}',[DisName] ='{1}',[OtherName] ='{2}',[TypeCode] ='{3}',[QuickCode] ='{4}',[Unit] ='{5}',[Price] ={6},[CostPrice] ={7} ,[QRCode] ='{8}' ,[Descript] ='{9}'";

            InsertSql = string.Format(InsertSql, Entity.StoCode, Entity.DisName, Entity.OtherName, Entity.TypeCode, Entity.QuickCode, Entity.Unit, Entity.Price, Entity.CostPrice, Entity.QRCode, Entity.Descript);
            sql.AppendFormat(" UPDATE TB_Dish SET " + InsertSql + " where DisCode='" + Entity.DisCode + "' and StoCode='" + Entity.StoCode + "' ;");
            #region 菜品图片
            if (!string.IsNullOrEmpty(Entity.ImageName))
            {
                sql.AppendLine(" delete TR_DishImage where DisCode=@DisCode;");
                string[] ins = Entity.ImageName.TrimEnd(',').Split(',');
                foreach (string name in ins)
                {
                    sql.AppendFormat(" INSERT INTO TR_DishImage(DisCode,ImgUrl) values(@DisCode,'" + name + "');");
                }
            }
            #endregion
            sql.AppendFormat(" set @returnval=1;");
            sql.AppendLine(" end");
            sql.AppendLine(" select @returnval;");
            DataTable dt = DBHelper.ExecuteDataTable(sql.ToString());
            if (dt != null && dt.Rows.Count > 0)
            {
                return(StringHelper.StringToInt(dt.Rows[0][0].ToString()));
            }
            else
            {
                return(2);
            }
        }
Beispiel #8
0
        /// <summary>
        /// 单行数据转实体对象
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private TB_DishEntity SetEntityInfo(DataRow dr)
        {
            TB_DishEntity Entity = new TB_DishEntity();

            Entity.Id = StringHelper.StringToLong(dr["Id"].ToString());
            //Entity.BusCode = dr["BusCode"].ToString();
            Entity.StoCode = dr["StoCode"].ToString();
            Entity.TStatus = dr["TStatus"].ToString();
            //Entity.ChannelCodeList = dr["ChannelCodeList"].ToString();
            Entity.DisCode   = dr["DisCode"].ToString();
            Entity.DisName   = dr["DisName"].ToString();
            Entity.OtherName = dr["OtherName"].ToString();
            Entity.TypeCode  = dr["TypeCode"].ToString();
            Entity.QuickCode = dr["QuickCode"].ToString();
            Entity.Unit      = dr["Unit"].ToString();
            Entity.Price     = StringHelper.StringToDecimal(dr["Price"].ToString());
            Entity.QRCode    = dr["QRCode"].ToString();
            Entity.Descript  = dr["Descript"].ToString();
            Entity.CostPrice = StringHelper.StringToDecimal(dr["CostPrice"].ToString());
            return(Entity);
        }
        /// <summary>
        /// 获取详情
        /// </summary>
        /// <param name="dicPar"></param>
        private void Detail(Dictionary <string, object> dicPar)
        {
            ///要检测的参数信息
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID", "userid", "DisCode"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            //获取参数信息
            string GUID    = dicPar["GUID"].ToString();
            string USER_ID = dicPar["USER_ID"].ToString();
            string DisCode = dicPar["DisCode"].ToString();
            //调用逻辑
            TB_DishEntity DEntity = bll.GetEntitySigInfo("Where DisCode='" + DisCode + "'");

            ReturnJsonByT <TB_DishEntity>(DEntity);
        }
Beispiel #10
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ref TB_DishEntity Entity)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append(" declare @ID int;");
            sql.Append(" declare @returnval int;");
            sql.Append(" set @returnval=0;");
            sql.Append("declare @DisCode varchar(32);");
            sql.Append("declare @DisMethodCode varchar(32);");
            sql.Append("exec [dbo].[p_GetbaseCode] @DisCode output;");
            sql.Append(" if exists(select 1 from TB_Dish where StoCode='" + Entity.StoCode + "' and DisName='" + Entity.DisName + "') set @returnval=1;");
            sql.Append("BEGIN TRANSACTION tan1");
            string InsertSql = " values('{0}',getdate(),'1',@DisCode,'{1}','{2}','{3}','{4}','{5}',{6},{7},'{8}','{9}')";

            InsertSql = string.Format(InsertSql, Entity.StoCode, Entity.DisName, Entity.OtherName, Entity.TypeCode, Entity.QuickCode, Entity.Unit, Entity.Price, Entity.CostPrice, Entity.QRCode, Entity.Descript);
            sql.AppendFormat(" INSERT INTO TB_Dish " + InsertSql + " ;");
            #region 菜品图片
            if (!string.IsNullOrEmpty(Entity.ImageName))
            {
                string[] ins = Entity.ImageName.Split(',');
                foreach (string name in ins)
                {
                    sql.AppendFormat(" INSERT INTO TR_DishImage(DisCode,ImgUrl) values(@DisCode,'/uploads/UpDishImages/" + name + "');");
                }
            }
            #endregion
            sql.AppendLine(" if(@@error=0) begin set @returnval=0; commit TRANSACTION tan1; end else begin rollback TRANSACTION tran1;set @returnval=1; end");
            sql.AppendLine(" select @returnval;");
            DataTable dt = DBHelper.ExecuteDataTable(sql.ToString());
            if (dt != null && dt.Rows.Count > 0)
            {
                return(StringHelper.StringToInt(dt.Rows[0][0].ToString()));
            }
            else
            {
                return(2);
            }
        }