public HandlingResult Update(StoreModel model) { HandlingResult result = new HandlingResult(); String sql = String.Format("UPDATE BPSYS_STORE SET NAME='{0}', PHONE='{1}' WHERE ID='{2}'",model.Name,model.Phone,model.Id); using (DataBaseProcess process = new DataBaseProcess()) { result.MsgNumber = process.Exec(sql); } result.Successed = result.MsgNumber > 0; result.Message = result.Successed ? "更新成功" : "更新失败"; return result; }
public HandlingResult Add(StoreModel model) { HandlingResult result=new HandlingResult(); String sql = "INSERT INTO BPSYS_STORE(ID, NAME, PHONE, CREATOR, CREATORID, CREATEDTIME) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')"; sql = String.Format(sql, model.Id, model.Name, model.Phone, UserInformationContext.LoginName, UserInformationContext.ID, DateTime.Now.ToString(ConfigImformationContext.TIME_FORMAT_FULL)); using (DataBaseProcess process=new DataBaseProcess()) { result.MsgNumber= process.Exec(sql); } result.Successed = result.MsgNumber > 0; result.Message = result.Successed ? "新增成功" : "新增失败"; return result; }
private HandlingResult ValidateStoreSave() { HandlingResult result=new HandlingResult(); StoreModel model=new StoreModel(); model.Name = textBoxName.Text.TrimStart().TrimEnd(); model.Phone = textBoxPhone.Text.TrimStart().TrimEnd(); if (String.IsNullOrEmpty(model.Name)) { result.Successed = false; result.Message = "请填写门店名称"; } model.Id = Guid.NewGuid(); result.Result = model; return result; }
private HandlingResult Validate() { HandlingResult result = new HandlingResult(); StoreModel model = new StoreModel(); model.Name = textBoxName.Text.Trim(); model.Phone = textBoxPhone.Text.Trim(); model.Id = Store.Id; if (String.IsNullOrEmpty(model.Name)) { result.Message += "请填写门店名称\r\n"; } //if (String.IsNullOrEmpty(model.Phone)) //{ // result.Message += "请填写门店电话\r\n"; //} result.Successed = result.Message.Length == 0; result.Result = model; return result; }
private void dataGridViewList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button.Equals(MouseButtons.Right)) { if (e.ColumnIndex >= 0 && e.RowIndex >= 0) { try { DataRowView drv = (DataRowView) dataGridViewList.Rows[e.RowIndex].DataBoundItem; DataRow dr = drv.Row; StoreModifyForm form = new StoreModifyForm(); StoreModel model = new StoreModel(); model.Id = Guid.Parse(dr["ID"].ToString()); model.Name = dr["Name"].ToString(); model.Phone = dr["Phone"].ToString(); form.Store = model; DialogResult result = form.ShowDialog(this); if (result == DialogResult.Yes) { LodaData(); } } catch (Exception ex) { _log.Error("View Sn information error::", ex); } } } }