//保存数据
        protected void Save_btn_Click(object sender, EventArgs e)
        {
            //获取页面信息
            string    pdicid  = this.ddl_pdicid.SelectedValue;
            string    dicname = txt_dicname.Text;
            string    orderno = txt_orderno.Text;
            string    status  = ddl_status.SelectedValue;
            string    cuser   = base.LoginedUser.UserID.ToString();
            string    diccode = "";
            DataTable dt      = new DataTable();

            if (hidId.Value.Length == 0 || hidId.Value == "0")//添加信息
            {
                string dicid = "";
                bll.Add("0", "0", dicid, pdicid, diccode, dicname, orderno, status);
                hidId.Value            = bll.oResult.Data;
                this.PageTitle.Operate = "修改";
            }
            else//修改信息
            {
                TB_DishTypeEntity UEntity = bll.GetEntitySigInfo("where pkcode='" + hidId.Value + "'");
                UEntity.PKKCode  = pdicid;
                UEntity.PKCode   = hidId.Value;
                UEntity.TypeName = dicname;
                UEntity.Sort     = StringHelper.StringToInt(orderno);
                UEntity.TStatus  = status;
                bll.Update("0", "0", UEntity);
                this.PageTitle.Operate = "修改";
            }
            //显示结果
            ShowResult(bll.oResult.Code, bll.oResult.Msg, errormessage);
        }
        /// <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 PKCode = dicPar["id"].ToString().Trim(',');

            TB_DishTypeEntity UEntity = bll.GetEntitySigInfo(" where pkcode='" + PKCode + "'");

            UEntity.TStatus = status;
            bll.Update(GUID, USER_ID, UEntity);
            ReturnResultJson(bll.oResult.Code, bll.oResult.Msg);
        }
        private void Update(Dictionary <string, object> dicPar)
        {
            //要检测的参数信息
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID", "Id", "BusCode", "StoCode", "PKCode", "TypeName", "Sort", "TStatus"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            //获取参数信息
            string GUID     = dicPar["GUID"].ToString();
            string USER_ID  = dicPar["USER_ID"].ToString();
            string PKCode   = dicPar["PKCode"].ToString();
            string TypeName = dicPar["TypeName"].ToString();
            string Sort     = dicPar["Sort"].ToString();
            //调用逻辑
            TB_DishTypeEntity UEntity = bll.GetEntitySigInfo(" where pkcode='" + PKCode + "'");

            UEntity.TypeName = TypeName;
            UEntity.Sort     = StringHelper.StringToInt(Sort);
            bll.Update(GUID, USER_ID, UEntity);
            ReturnResultJson(bll.oResult.Code, bll.oResult.Msg);
        }
Exemple #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(string GUID, string UID, TB_DishTypeEntity UEntity)
        {
            //更新数据
            int result = dal.Update(UEntity);

            //检测执行结果
            CheckResult(result, "");
        }
Exemple #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(TB_DishTypeEntity Entity)
 {
     SqlParameter[] sqlParameters =
     {
         new SqlParameter("@PKCode",   Entity.PKCode),
         new SqlParameter("@TypeName", Entity.TypeName),
         new SqlParameter("@Sort",     Entity.Sort),
         new SqlParameter("@TStatus",  Entity.TStatus)
     };
     return(DBHelper.ExecuteNonQuery("dbo.p_TB_DishType_Update", CommandType.StoredProcedure, sqlParameters));
 }
Exemple #6
0
        /// <summary>
        /// 单行数据转实体对象
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private TB_DishTypeEntity SetEntityInfo(DataRow dr)
        {
            TB_DishTypeEntity Entity = new TB_DishTypeEntity();

            Entity.Id       = StringHelper.StringToLong(dr["Id"].ToString());
            Entity.PKKCode  = dr["PKKCode"].ToString();
            Entity.PKCode   = dr["PKCode"].ToString();
            Entity.TypeName = dr["TypeName"].ToString();
            Entity.Sort     = StringHelper.StringToInt(dr["Sort"].ToString());
            Entity.TStatus  = dr["TStatus"].ToString();
            return(Entity);
        }
Exemple #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ref TB_DishTypeEntity Entity)
 {
     intReturn = 0;
     SqlParameter[] sqlParameters =
     {
         new SqlParameter("@PKKCode",  Entity.PKKCode),
         new SqlParameter("@PKCode",   SqlDbType.NVarChar,32),
         new SqlParameter("@TypeName", Entity.TypeName),
         new SqlParameter("@Sort",     Entity.Sort),
         new SqlParameter("@TStatus",  Entity.TStatus)
     };
     sqlParameters[1].Direction = ParameterDirection.Output;
     intReturn = DBHelper.ExecuteNonQuery("dbo.p_TB_DishType_Add", CommandType.StoredProcedure, sqlParameters);
     if (intReturn == 0)
     {
         Entity.PKCode = sqlParameters[1].Value.ToString();
     }
     return(intReturn);
 }
Exemple #8
0
        /// <summary>
        /// 检验表单数据
        /// </summary>
        /// <returns></returns>
        public bool CheckPageInfo(string type, string Id, string PKKCode, string PKCode, string TypeName, string Sort, string TStatus)
        {
            bool rel = false;

            try
            {
                Entity          = new TB_DishTypeEntity();
                Entity.Id       = StringHelper.StringToLong(Id);
                Entity.PKKCode  = PKKCode;
                Entity.PKCode   = PKCode;
                Entity.TypeName = TypeName;
                Entity.Sort     = StringHelper.StringToInt(Sort);
                Entity.TStatus  = TStatus;
                rel             = true;
            }
            catch (System.Exception)
            {
            }
            return(rel);
        }