public bool Add(Business_DataModel model) { StringBuilder builder = new StringBuilder(); builder.Append(" insert into opm_business_data(uid,btype,prjid,bcode,bname,codeid,dutyuser,designer,flowstate,begindate, "); builder.Append(" enddate,cause,remark,adduser,addtime,isvalid) "); builder.Append(" values( "); builder.Append(" '" + model.UID + "', "); builder.Append(" '" + model.BType + "', "); builder.Append(" '" + model.PrjId + "', "); builder.Append(" '" + model.BCode + "', "); builder.Append(" '" + model.BName + "', "); builder.Append(" " + model.CodeId + ", "); builder.Append(" '" + model.DutyUser + "', "); builder.Append(" '" + model.Designer + "',"); builder.Append(" " + model.FlowState + ", "); builder.Append(" '" + model.BeginDate + "', "); if (model.EndDate != null) { builder.Append(" '" + model.EndDate + "', "); } else { builder.Append(" NULL, "); } builder.Append(" '" + model.Cause + "', "); builder.Append(" '" + model.Remark + "', "); builder.Append(" '" + model.AddUser + "', "); builder.Append(" '" + model.AddTime + "', "); builder.Append(" '" + model.IsValid + "' )"); return(publicDbOpClass.NonQuerySqlString(builder.ToString())); }
public Business_DataModel GetModel() { Business_DataModel business_DataModel = new Business_DataModel(); if (this.hdnUID.Value != "") { business_DataModel.UID = this.hdnUID.Value; } else { business_DataModel.UID = System.Guid.NewGuid().ToString(); } business_DataModel.BType = base.Request["codetype"].ToString(); business_DataModel.PrjId = base.Request["pc"].ToString(); business_DataModel.BCode = this.txtBCode.Text.Trim().Replace("'", "''"); business_DataModel.BName = this.txtBName.Text.Trim().Replace("'", "''"); business_DataModel.CodeId = this.CodeID; business_DataModel.DutyUser = this.txtDutyUser.Text.Trim().Replace("'", "''"); if (this.hdfusercode.Value != "") { business_DataModel.Designer = this.hdfusercode.Value; } else { business_DataModel.Designer = this.txtDesigner.Value.Trim().Replace("'", "''"); } business_DataModel.BeginDate = System.Convert.ToDateTime(this.txtBeginDate.Text); if (this.txtEndDate.Text != "") { business_DataModel.EndDate = this.txtEndDate.Text; } else { business_DataModel.EndDate = null; } business_DataModel.Cause = this.txtCause.Value; business_DataModel.Remark = this.txtRemark.Value.Replace("'", "''"); business_DataModel.AddUser = base.UserCode; business_DataModel.AddTime = System.Convert.ToDateTime(System.DateTime.Now.ToShortDateString()); business_DataModel.IsValid = "1"; business_DataModel.FlowState = -1; return(business_DataModel); }
public bool Update(Business_DataModel model) { StringBuilder builder = new StringBuilder(); builder.Append(" update opm_business_data set "); builder.Append(" btype='" + model.BType + "',"); builder.Append(" BCode='" + model.BCode + "',"); builder.Append(" BName='" + model.BName + "',"); builder.Append(" DutyUser='******',"); builder.Append(" Designer='" + model.Designer + "',"); builder.Append(" BeginDate='" + model.BeginDate + "',"); if (model.EndDate != null) { builder.Append(" EndDate='" + model.EndDate + "',"); } else { builder.Append(" EndDate=NULL,"); } builder.Append(" Cause='" + model.Cause + "',"); builder.Append(" Remark='" + model.Remark + "'"); builder.Append(" where UID='" + model.UID + "'"); return(publicDbOpClass.NonQuerySqlString(builder.ToString())); }
protected void btnSave_Click(object sender, System.EventArgs e) { Business_DataModel model = new Business_DataModel(); model = this.GetModel(); if (base.Request["type"] != null) { if (base.Request["type"].ToString() == "add") { if (this.action.Add(model)) { base.RegisterScript("top.ui.tabSuccess({ parentName: '_Business_Data_Manage' });"); return; } } else { if (this.action.Update(model)) { base.RegisterScript("top.ui.tabSuccess({ parentName: '_Business_Data_Manage' });"); } } } }