protected void btnSubmit_Click(object sender, EventArgs e) { string name = txtPositionName.Value.Trim(); string remark = txtRemark.Text.Trim(); Position model = new Position(); if (Mode == OperateMode.UPDATE) { model = bll.GetModel(Id); } model.PositionName = name; model.Remark = remark; model.LastUpdateDate = DateTime.Now; // 新增 if (Mode == OperateMode.ADD) { model.CreateDate = DateTime.Now; bll.Add(model); WebCommon.ResetControl(this.form1); } else { bll.Update(model); } WebCommon.DialogSuccessMsg(this, "保存成功!"); }
public void btnSubmit_Click(object sender, EventArgs e) { DictItems itemModel = new DictItems(); string dictCode = txtCode.Value.Trim(); string itemCode = txtItemCode.Value.Trim(); string name = txtName.Value.Trim(); string itemValue = txtItemValue.Value.Trim(); string remark = txtRemark.Value.Trim(); // 修改 if (Mode == OperateMode.UPDATE) { // 如果存在重名,返回 if (diBll.IsExists(item => item.ItemCode != UpdateItemCode && item.ItemCode == itemCode)) { WebCommon.DialogAlertMsg(this, "项编号已经存在,请重新输入!", string.Format("$('#{0}').focus();", txtItemCode.ClientID)); return; } itemModel = diBll.GetModel(itemID); itemModel.ItemCode = itemCode; itemModel.ItemName = name; itemModel.ItemValue = itemValue; itemModel.Remark = remark; itemModel.LastUpdateDate = DateTime.Now; diBll.Update(itemModel); } else // 新增 { if (string.IsNullOrEmpty(itemCode)) { WebCommon.DialogAlertMsg(this, "项编号不能为空,请重新输入!", string.Format("$('#{0}').focus();", txtItemCode.ClientID)); return; } if (diBll.IsExists(item => item.DictCode == dictCode && item.ItemCode == itemCode)) { WebCommon.DialogAlertMsg(this, "项编号已经存在,请重新输入!", string.Format("$('#{0}').focus();", txtItemCode.ClientID)); return; } itemModel.DictCode = dictCode; itemModel.CreateDate = DateTime.Now; itemModel.ItemCode = itemCode; itemModel.ItemName = name; itemModel.ItemValue = itemValue; itemModel.Remark = remark; itemModel.LastUpdateDate = DateTime.Now; diBll.Add(itemModel); WebCommon.ResetControl(this.form1); } WebCommon.DialogSuccessMsg(this, "保存成功!"); }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e) { string command = e.CommandName; object arg = e.CommandArgument; if (e.CommandName == "del") { diBll.Delete(new DictItems { DictItemID = TypeParse.Object2Int32(arg, 0) }); WebCommon.DialogSuccessMsg(this, "删除成功!"); } this.BindData(); }
protected void btnSubmit_Click(object sender, EventArgs e) { Dict dictModel = new Dict(); string code = txtCode.Value.Trim(); string name = txtName.Value.Trim(); string remark = txtRemark.Value.Trim(); if (Mode == OperateMode.UPDATE) { dictModel = dictBll.GetModel(dictID); dictModel.DictName = name; dictModel.Remark = remark; dictModel.LastUpdateDate = DateTime.Now; dictBll.Update(dictModel); } else // add { if (string.IsNullOrEmpty(code)) { WebCommon.DialogAlertMsg(this, "字典编号不能为空,请重新输入!", string.Format("$('#{0}').focus();", txtCode.ClientID)); return; } if (dictBll.IsExistsCode(code)) { WebCommon.DialogAlertMsg(this, "字典编号已经存在,请重新输入!", string.Format("$('#{0}').focus();", txtCode.ClientID)); return; } dictModel.Code = code; dictModel.CreateDate = DateTime.Now; dictModel.DictName = name; dictModel.Remark = remark; dictModel.LastUpdateDate = DateTime.Now; dictBll.Add(dictModel); WebCommon.ResetControl(this.form1); } WebCommon.DialogSuccessMsg(this, "保存成功!"); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void btnSubmit_Click(object sender, EventArgs e) { string name = txtName.Value.Trim(); string shortName = txtShortName.Value.Trim(); string address = txtAddress.Value.Trim(); string phone = txtPhone.Value.Trim(); string fax = txtFax.Value.Trim(); string remark = txtRemark.Value.Trim(); Department model = new Department(); // 更新获取数据 if (Mode == OperateMode.UPDATE) { model = deptBll.GetModel(DeptID); } model.DeptName = name; model.ShotDeptName = shortName; model.Address = address; model.Tel = phone; model.Fax = fax; model.Remark = remark; model.LastUpdateDate = DateTime.Now; if (Mode == OperateMode.ADD) { model.CreateDate = DateTime.Now; deptBll.Add(model); WebCommon.ResetControl(this.form1); } else { deptBll.Update(model); } WebCommon.DialogSuccessMsg(this, "保存成功!"); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { Users user = new Users(); if (Mode == OperateMode.UPDATE) { user = bll.GetModel(id); } else { user.UserName = txtUserName.Value.Trim(); } if (!string.IsNullOrEmpty(ddlStatus.SelectedValue)) { user.Status = Convert.ToInt32(ddlStatus.SelectedValue); } user.RealName = txtName.Value.Trim(); if (!string.IsNullOrEmpty(ddlSex.SelectedValue)) { user.Sex = TypeParse.Object2Int32(ddlSex.SelectedValue, 0); } if (!string.IsNullOrEmpty(ddlEducation.SelectedValue)) { user.Education = ddlEducation.SelectedValue; } user.Mobile = txtMobile.Value.Trim(); user.Tel = txtPhone.Value.Trim(); user.Email = txtEmail.Value.Trim(); user.QQ = txtQQ.Value.Trim(); if (!string.IsNullOrEmpty(txtBirth.Value.Trim())) { user.Birthday = TypeParse.Object2DateTime(txtBirth.Value.Trim(), DateTime.MinValue); } user.Company = txtCompany.Value.Trim(); user.Remark = txtRemark.Value.Trim(); user.Question = ddlSafeQuestion.SelectedValue; user.Answer = txtSafeA.Value.Trim(); user.LastUpdateDate = DateTime.Now; // 新增 if (Mode == OperateMode.ADD) { user.UserID = Guid.NewGuid().ToString(); user.CreateDate = DateTime.Now; object userID = bll.Add(user); // this.SaveDepartmentUser((user as Users).UserID); WebCommon.ResetControl(this.form1); } else if (Mode == OperateMode.UPDATE) // 更新 { bll.Update(user); // this.SaveDepartmentUser(id); } WebCommon.DialogSuccessMsg(this, "保存成功!"); }