Beispiel #1
0
        public int UpdateDepotsProperty(DepotsPropertyEntity de)
        {
            StringBuilder sb = new StringBuilder("update dbo.DepotsProperty set");

            sb.AppendFormat(" Dpr_Remark='{0}', ", de.DprRemark);
            sb.AppendFormat(" Dpr_IfUse={0} ", de.DprIfUse == true ? 1 : 0);
            sb.AppendFormat(" where Dpr_Id={0}", de.DprId);
            return(SqlDataHelper.ExecuteNonQuery(SqlDataHelper.GetConnection(), CommandType.Text, sb.ToString()));
        }
Beispiel #2
0
        public int InsertDepotsProperty(DepotsPropertyEntity de)
        {
            StringBuilder sb = new StringBuilder("insert into DepotsProperty(Dpr_Name,Dpr_Remark,Dpr_IfUse) values(");

            sb.AppendFormat(" '{0}',", de.DprName);
            sb.AppendFormat(" '{0}',", de.DprRemark);
            sb.AppendFormat(" '{0}')", de.DprIfUse == true ? 1 : 0);
            return(SqlDataHelper.ExecuteNonQuery(SqlDataHelper.GetConnection(), CommandType.Text, sb.ToString()));
        }
Beispiel #3
0
        public void BtnDepotsSave(object sender, EventArgs e)
        {
            DepotsPropertyEntity dpe = new DepotsPropertyEntity()
            {
                DprName   = this.View.TxtDepotsName.Text,
                DprRemark = this.View.TxtDepotsRemark.Text,
                DprIfUse  = this.View.CboDepotsIfUse.Checked
            };

            if (this.View.TxtDepotsId.Text != null && this.View.TxtDepotsId.Text != "")
            {
                dpe.DprId = Convert.ToInt32(this.View.TxtDepotsId.Text);
                string             jsonresult = MyBaseMessageService.EditDepotsProperty(dpe);
                FeedbackInfomation fi         = JsonConvert.DeserializeObject <FeedbackInfomation>(jsonresult);
                if (fi.ErrorStatus == STATUS_ADAPTER.SAVE_SUCCESS)
                {
                    LoadDepotsPropertyData();
                    this.View.DgvDepots.Rows[depotsRowIndex].Selected = true;
                    MsgBox.ShowDialog(fi.FeedbackMessage, "信息提示");
                }
                else
                {
                    MsgBox.ShowDialog(fi.FeedbackMessage, "信息提示", MsgBox.MyButtons.OKCancel, true);
                }
            }
            else
            {
                string result = CheckDepotsName(dpe.DprName);
                if (result == "正确")
                {
                    string             jsonresult = MyBaseMessageService.AddDepotsProperty(dpe);
                    FeedbackInfomation fi         = JsonConvert.DeserializeObject <FeedbackInfomation>(jsonresult);
                    if (fi.ErrorStatus == STATUS_ADAPTER.INSERT_NORMAL)
                    {
                        LoadDepotsPropertyData();
                        this.View.DgvDepots.Rows[this.View.DgvDepots.Rows.Count - 1].Selected = true;
                        MsgBox.ShowDialog(fi.FeedbackMessage, "信息提示");
                    }
                    else
                    {
                        MsgBox.ShowDialog(fi.FeedbackMessage, "信息提示", MsgBox.MyButtons.OKCancel, true);
                    }
                }
                else
                {
                    MsgBox.ShowDialog(result, "信息提示", MsgBox.MyButtons.OKCancel, true);
                }
            }
            this.View.TxtDepotsName.Enabled   = false;
            this.View.TxtDepotsRemark.Enabled = false;
            this.View.CboDepotsIfUse.Enabled  = false;
            this.View.BtnDepotsSave.Enabled   = false;
            this.View.BtnDepotsAdd.Enabled    = true;
        }
Beispiel #4
0
        public DepotsPropertyEntity DsToDepotsPropertyEntity(DataSet ds)
        {
            DepotsPropertyEntity de = new DepotsPropertyEntity();

            if (DataValidate.CheckDataSetNotEmpty(ds))
            {
                var dr = ds.Tables[0].Rows[0];
                de.DprId     = Convert.ToInt32(dr["Dpr_Id"]);
                de.DprName   = dr["Dpr_Name"].ToString();
                de.DprRemark = dr["Dpr_Remark"].ToString();
                de.DprIfUse  = Convert.ToBoolean(Convert.IsDBNull(dr["Dpr_IfUse"]) == true ? false : dr["Dpr_IfUse"]);
                de.DprIfUse2 = Convert.ToBoolean(dr["Dpr_IfUse"]) == true ? "是" : "否";
            }
            return(de);
        }
Beispiel #5
0
        public List <DepotsPropertyEntity> DsToDepotsPropertyEntityList(DataSet ds)
        {
            List <DepotsPropertyEntity> des = new List <DepotsPropertyEntity>();

            if (DataValidate.CheckDataSetNotEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    DepotsPropertyEntity de = new DepotsPropertyEntity();
                    de.DprId     = Convert.ToInt32(dr["Dpr_Id"]);
                    de.DprName   = dr["Dpr_Name"].ToString();
                    de.DprRemark = dr["Dpr_Remark"].ToString();
                    de.DprIfUse  = Convert.ToBoolean(Convert.IsDBNull(dr["Dpr_IfUse"]) == true ? false : dr["Dpr_IfUse"]);
                    de.DprIfUse2 = Convert.ToBoolean(dr["Dpr_IfUse"]) == true ? "是" : "否";
                    des.Add(de);
                }
            }
            return(des);
        }
Beispiel #6
0
        public FeedbackInfomation EditDepotsProperty(DepotsPropertyEntity de)
        {
            FeedbackInfomation fi = new FeedbackInfomation();

            try
            {
                fi.Result          = MyBaseMessageDAL.UpdateDepotsProperty(de);
                fi.ErrorStatus     = STATUS_ADAPTER.SAVE_SUCCESS;
                fi.FeedbackMessage = "修改成功";
                return(fi);
            }
            catch (Exception ex)
            {
                fi.Result          = "";
                fi.ErrorStatus     = STATUS_ADAPTER.SAVE_FAILED;
                fi.FeedbackMessage = ex.Message.ToString();
                return(fi);
            }
        }
Beispiel #7
0
        public FeedbackInfomation AddDepotsProperty(DepotsPropertyEntity de)
        {
            FeedbackInfomation fi = new FeedbackInfomation();

            try
            {
                fi.Result          = MyBaseMessageDAL.InsertDepotsProperty(de);
                fi.ErrorStatus     = STATUS_ADAPTER.INSERT_NORMAL;
                fi.FeedbackMessage = "新增成功";
                return(fi);
            }
            catch (Exception ex)
            {
                fi.Result          = "";
                fi.ErrorStatus     = STATUS_ADAPTER.INSERT_ERROR;
                fi.FeedbackMessage = ex.Message.ToString();
                return(fi);
            }
        }
Beispiel #8
0
 public string EditDepotsProperty(DepotsPropertyEntity de)
 {
     return(JsonConvert.SerializeObject(MyBaseMessageBll.EditDepotsProperty(de)));
 }