示例#1
0
        public int UpdateStorageWay(StorageWayEntity se)
        {
            StringBuilder sb = new StringBuilder("update dbo.StorageWay set");

            sb.AppendFormat(" Swa_Remark='{0}', ", se.SwaRemark);
            sb.AppendFormat(" Swa_IfUse={0} ", se.SwaIfUse == true ? 1 : 0);
            sb.AppendFormat(" where Swa_Id={0}", se.SwaId);
            return(SqlDataHelper.ExecuteNonQuery(SqlDataHelper.GetConnection(), CommandType.Text, sb.ToString()));
        }
示例#2
0
        public int InsertStorageWay(StorageWayEntity se)
        {
            StringBuilder sb = new StringBuilder("insert into StorageWay(Swa_Name,Swa_Remark,Swa_IfUse) values(");

            sb.AppendFormat(" '{0}',", se.SwaName);
            sb.AppendFormat(" '{0}',", se.SwaRemark);
            sb.AppendFormat(" '{0}')", se.SwaIfUse == true ? 1 : 0);
            return(SqlDataHelper.ExecuteNonQuery(SqlDataHelper.GetConnection(), CommandType.Text, sb.ToString()));
        }
示例#3
0
        public void BtnStorageSave(object sender, EventArgs e)
        {
            StorageWayEntity swe = new StorageWayEntity()
            {
                SwaName   = this.View.TxtStorageName.Text,
                SwaRemark = this.View.TxtStorageRemark.Text,
                SwaIfUse  = this.View.CboStorageIfUse.Checked
            };

            if (this.View.TxtStorageId.Text != null && this.View.TxtStorageId.Text != "")
            {
                swe.SwaId = Convert.ToInt32(this.View.TxtStorageId.Text);
                string             jsonresult = MyBaseMessageService.EditStorageWay(swe);
                FeedbackInfomation fi         = JsonConvert.DeserializeObject <FeedbackInfomation>(jsonresult);
                if (fi.ErrorStatus == STATUS_ADAPTER.SAVE_SUCCESS)
                {
                    LoadStorageWayData();
                    this.View.DgvStorage.Rows[storageRowIndex].Selected = true;
                    MsgBox.ShowDialog(fi.FeedbackMessage, "信息提示");
                }
                else
                {
                    MsgBox.ShowDialog(fi.FeedbackMessage, "信息提示", MsgBox.MyButtons.OKCancel, true);
                }
            }
            else
            {
                string result = CheckStorageName(swe.SwaName);
                if (result == "正确")
                {
                    string             jsonresult = MyBaseMessageService.AddStorageWay(swe);
                    FeedbackInfomation fi         = JsonConvert.DeserializeObject <FeedbackInfomation>(jsonresult);
                    if (fi.ErrorStatus == STATUS_ADAPTER.INSERT_NORMAL)
                    {
                        LoadStorageWayData();
                        this.View.DgvStorage.Rows[this.View.DgvStorage.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.TxtStorageName.Enabled   = false;
            this.View.TxtStorageRemark.Enabled = false;
            this.View.CboStorageIfUse.Enabled  = false;
            this.View.BtnStorageSave.Enabled   = false;
            this.View.BtnStorageAdd.Enabled    = true;
        }
示例#4
0
        public StorageWayEntity DsToStorageWayEntity(DataSet ds)
        {
            StorageWayEntity se = new StorageWayEntity();

            if (DataValidate.CheckDataSetNotEmpty(ds))
            {
                var dr = ds.Tables[0].Rows[0];
                se.SwaId     = Convert.ToInt32(dr["Swa_Id"]);
                se.SwaName   = dr["Swa_Name"].ToString();
                se.SwaRemark = dr["Swa_Remark"].ToString();
                se.SwaIfUse  = Convert.ToBoolean(Convert.IsDBNull(dr["Swa_IfUse"]) == true ? false : dr["Swa_IfUse"]);
                se.SwaIfUse2 = Convert.ToBoolean(dr["Swa_IfUse"]) == true ? "是" : "否";
            }
            return(se);
        }
示例#5
0
        public List <StorageWayEntity> DsToStorageWayEntityList(DataSet ds)
        {
            List <StorageWayEntity> ses = new List <StorageWayEntity>();

            if (DataValidate.CheckDataSetNotEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    StorageWayEntity se = new StorageWayEntity();
                    se.SwaId     = Convert.ToInt32(dr["Swa_Id"]);
                    se.SwaName   = dr["Swa_Name"].ToString();
                    se.SwaRemark = dr["Swa_Remark"].ToString();
                    se.SwaIfUse  = Convert.ToBoolean(Convert.IsDBNull(dr["Swa_IfUse"]) == true ? false : dr["Swa_IfUse"]);
                    se.SwaIfUse2 = Convert.ToBoolean(dr["Swa_IfUse"]) == true ? "是" : "否";
                    ses.Add(se);
                }
            }
            return(ses);
        }
示例#6
0
        public FeedbackInfomation EditStorageWay(StorageWayEntity se)
        {
            FeedbackInfomation fi = new FeedbackInfomation();

            try
            {
                fi.Result          = MyBaseMessageDAL.UpdateStorageWay(se);
                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);
            }
        }
示例#7
0
        public FeedbackInfomation AddStorageWay(StorageWayEntity se)
        {
            FeedbackInfomation fi = new FeedbackInfomation();

            try
            {
                fi.Result          = MyBaseMessageDAL.InsertStorageWay(se);
                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);
            }
        }
示例#8
0
 public string EditStorageWay(StorageWayEntity se)
 {
     return(JsonConvert.SerializeObject(MyBaseMessageBll.EditStorageWay(se)));
 }