Example #1
0
        public int UpdateMeasureWay(MeasureWayEntity me)
        {
            StringBuilder sb = new StringBuilder("update dbo.MeasureWay set");

            sb.AppendFormat(" Mwa_Remark='{0}', ", me.MwaRemark);
            sb.AppendFormat(" Mwa_IfUse={0} ", me.MwaIfUse == true ? 1 : 0);
            sb.AppendFormat(" where Mwa_Id={0}", me.MwaId);
            return(SqlDataHelper.ExecuteNonQuery(SqlDataHelper.GetConnection(), CommandType.Text, sb.ToString()));
        }
Example #2
0
        public int InsertMeasureWay(MeasureWayEntity me)
        {
            StringBuilder sb = new StringBuilder("insert into MeasureWay(Mwa_Name,Mwa_Remark,Mwa_IfUse) values(");

            sb.AppendFormat(" '{0}',", me.MwaName);
            sb.AppendFormat(" '{0}',", me.MwaRemark);
            sb.AppendFormat(" '{0}')", me.MwaIfUse == true ? 1 : 0);
            return(SqlDataHelper.ExecuteNonQuery(SqlDataHelper.GetConnection(), CommandType.Text, sb.ToString()));
        }
Example #3
0
        public void BtnMeasureSave(object sender, EventArgs e)
        {
            MeasureWayEntity mwe = new MeasureWayEntity()
            {
                MwaName   = this.View.TxtMeasureName.Text,
                MwaRemark = this.View.TxtMeasureRemark.Text,
                MwaIfUse  = this.View.CboMeasureIfUse.Checked
            };

            if (this.View.TxtMeasureId.Text != null && this.View.TxtMeasureId.Text != "")
            {
                mwe.MwaId = Convert.ToInt32(this.View.TxtMeasureId.Text);
                string             jsonresult = MyBaseMessageService.EditMeasureWay(mwe);
                FeedbackInfomation fi         = JsonConvert.DeserializeObject <FeedbackInfomation>(jsonresult);
                if (fi.ErrorStatus == STATUS_ADAPTER.SAVE_SUCCESS)
                {
                    LoadMeasureWayData();
                    this.View.DgvMeasure.Rows[measureRowIndex].Selected = true;
                    MsgBox.ShowDialog(fi.FeedbackMessage, "信息提示");
                }
                else
                {
                    MsgBox.ShowDialog(fi.FeedbackMessage, "信息提示", MsgBox.MyButtons.OKCancel, true);
                }
            }
            else
            {
                string result = CheckMeasureName(mwe.MwaName);
                if (result == "正确")
                {
                    string             jsonresult = MyBaseMessageService.AddMeasureWay(mwe);
                    FeedbackInfomation fi         = JsonConvert.DeserializeObject <FeedbackInfomation>(jsonresult);
                    if (fi.ErrorStatus == STATUS_ADAPTER.INSERT_NORMAL)
                    {
                        LoadMeasureWayData();
                        this.View.DgvMeasure.Rows[this.View.DgvMeasure.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.TxtMeasureName.Enabled   = false;
            this.View.TxtMeasureRemark.Enabled = false;
            this.View.CboMeasureIfUse.Enabled  = false;
            this.View.BtnMeasureSave.Enabled   = false;
            this.View.BtnMeasureAdd.Enabled    = true;
        }
Example #4
0
        public MeasureWayEntity DsToMeasureWayEntity(DataSet ds)
        {
            MeasureWayEntity me = new MeasureWayEntity();

            if (DataValidate.CheckDataSetNotEmpty(ds))
            {
                var dr = ds.Tables[0].Rows[0];
                me.MwaId     = Convert.ToInt32(dr["Mwa_Id"]);
                me.MwaName   = dr["Mwa_Name"].ToString();
                me.MwaRemark = dr["Mwa_Remark"].ToString();
                me.MwaIfUse  = Convert.ToBoolean(Convert.IsDBNull(dr["Mwa_IfUse"]) == true ? false : dr["Mwa_IfUse"]);
                me.MwaIfUse2 = Convert.ToBoolean(dr["Mwa_IfUse"]) == true ? "是" : "否";
            }
            return(me);
        }
Example #5
0
        public List <MeasureWayEntity> DsToMeasureWayEntityList(DataSet ds)
        {
            List <MeasureWayEntity> mes = new List <MeasureWayEntity>();

            if (DataValidate.CheckDataSetNotEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    MeasureWayEntity me = new MeasureWayEntity();
                    me.MwaId     = Convert.ToInt32(dr["Mwa_Id"]);
                    me.MwaName   = dr["Mwa_Name"].ToString();
                    me.MwaRemark = dr["Mwa_Remark"].ToString();
                    me.MwaIfUse  = Convert.ToBoolean(Convert.IsDBNull(dr["Mwa_IfUse"]) == true ? false : dr["Mwa_IfUse"]);
                    me.MwaIfUse2 = Convert.ToBoolean(dr["Mwa_IfUse"]) == true ? "是" : "否";
                    mes.Add(me);
                }
            }
            return(mes);
        }
Example #6
0
        public FeedbackInfomation EditMeasureWay(MeasureWayEntity me)
        {
            FeedbackInfomation fi = new FeedbackInfomation();

            try
            {
                fi.Result          = MyBaseMessageDAL.UpdateMeasureWay(me);
                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);
            }
        }
Example #7
0
        public FeedbackInfomation AddMeasureWay(MeasureWayEntity me)
        {
            FeedbackInfomation fi = new FeedbackInfomation();

            try
            {
                fi.Result          = MyBaseMessageDAL.InsertMeasureWay(me);
                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);
            }
        }
Example #8
0
 public string EditMeasureWay(MeasureWayEntity me)
 {
     return(JsonConvert.SerializeObject(MyBaseMessageBll.EditMeasureWay(me)));
 }