public int UpdateOutboundWay(OutboundWayEntity oe) { StringBuilder sb = new StringBuilder("update dbo.OutboundWay set"); sb.AppendFormat(" Owa_Remark='{0}', ", oe.OwaRemark); sb.AppendFormat(" Owa_IfUse={0} ", oe.OwaIfUse == true ? 1 : 0); sb.AppendFormat(" where Owa_Id={0}", oe.OwaId); return(SqlDataHelper.ExecuteNonQuery(SqlDataHelper.GetConnection(), CommandType.Text, sb.ToString())); }
public int InsertOutboundWay(OutboundWayEntity oe) { StringBuilder sb = new StringBuilder("insert into OutboundWay(Owa_Name,Owa_Remark,Owa_IfUse) values("); sb.AppendFormat(" '{0}',", oe.OwaName); sb.AppendFormat(" '{0}',", oe.OwaRemark); sb.AppendFormat(" '{0}')", oe.OwaIfUse == true ? 1 : 0); return(SqlDataHelper.ExecuteNonQuery(SqlDataHelper.GetConnection(), CommandType.Text, sb.ToString())); }
public void BtnOutboundSave(object sender, EventArgs e) { OutboundWayEntity owe = new OutboundWayEntity() { OwaName = this.View.TxtOutboundName.Text, OwaRemark = this.View.TxtOutboundRemark.Text, OwaIfUse = this.View.CboOutboundIfUse.Checked }; if (this.View.TxtOutboundId.Text != null && this.View.TxtOutboundId.Text != "") { owe.OwaId = Convert.ToInt32(this.View.TxtOutboundId.Text); string jsonresult = MyBaseMessageService.EditOutboundWay(owe); FeedbackInfomation fi = JsonConvert.DeserializeObject <FeedbackInfomation>(jsonresult); if (fi.ErrorStatus == STATUS_ADAPTER.SAVE_SUCCESS) { LoadOutboundWayData(); this.View.DgvOutbound.Rows[outboundRowIndex].Selected = true; MsgBox.ShowDialog(fi.FeedbackMessage, "信息提示"); } else { MsgBox.ShowDialog(fi.FeedbackMessage, "信息提示", MsgBox.MyButtons.OKCancel, true); } } else { string result = CheckOutboundName(owe.OwaName); if (result == "正确") { string jsonresult = MyBaseMessageService.AddOutboundWay(owe); FeedbackInfomation fi = JsonConvert.DeserializeObject <FeedbackInfomation>(jsonresult); if (fi.ErrorStatus == STATUS_ADAPTER.INSERT_NORMAL) { LoadOutboundWayData(); this.View.DgvOutbound.Rows[this.View.DgvOutbound.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.TxtOutboundName.Enabled = false; this.View.TxtOutboundRemark.Enabled = false; this.View.CboOutboundIfUse.Enabled = false; this.View.BtnOutboundSave.Enabled = false; this.View.BtnOutboundAdd.Enabled = true; }
public OutboundWayEntity DsToOutboundWayEntity(DataSet ds) { OutboundWayEntity oe = new OutboundWayEntity(); if (DataValidate.CheckDataSetNotEmpty(ds)) { var dr = ds.Tables[0].Rows[0]; oe.OwaId = Convert.ToInt32(dr["Owa_Id"]); oe.OwaName = dr["Owa_Name"].ToString(); oe.OwaRemark = dr["Owa_Remark"].ToString(); oe.OwaIfUse = Convert.ToBoolean(Convert.IsDBNull(dr["Owa_IfUse"]) == true ? false : dr["Owa_IfUse"]); oe.OwaIfUse2 = Convert.ToBoolean(dr["Owa_IfUse"]) == true ? "是" : "否"; } return(oe); }
public List <OutboundWayEntity> DsToOutboundWayEntityList(DataSet ds) { List <OutboundWayEntity> oes = new List <OutboundWayEntity>(); if (DataValidate.CheckDataSetNotEmpty(ds)) { foreach (DataRow dr in ds.Tables[0].Rows) { OutboundWayEntity oe = new OutboundWayEntity(); oe.OwaId = Convert.ToInt32(dr["Owa_Id"]); oe.OwaName = dr["Owa_Name"].ToString(); oe.OwaRemark = dr["Owa_Remark"].ToString(); oe.OwaIfUse = Convert.ToBoolean(Convert.IsDBNull(dr["Owa_IfUse"]) == true ? false : dr["Owa_IfUse"]); oe.OwaIfUse2 = Convert.ToBoolean(dr["Owa_IfUse"]) == true ? "是" : "否"; oes.Add(oe); } } return(oes); }
public FeedbackInfomation EditOutboundWay(OutboundWayEntity oe) { FeedbackInfomation fi = new FeedbackInfomation(); try { fi.Result = MyBaseMessageDAL.UpdateOutboundWay(oe); 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); } }
public FeedbackInfomation AddOutboundWay(OutboundWayEntity oe) { FeedbackInfomation fi = new FeedbackInfomation(); try { fi.Result = MyBaseMessageDAL.InsertOutboundWay(oe); 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); } }
public string EditOutboundWay(OutboundWayEntity oe) { return(JsonConvert.SerializeObject(MyBaseMessageBll.EditOutboundWay(oe))); }