protected void btnAdd_Click(object sender, EventArgs e) { OAOfficeResApplicationCollect data = this.GetData(); if (this.OperateType == "add") { int num = this.amAction.Add(data); if (num > 0) { this.Page.RegisterStartupScript("", "<script>alert('添加成功!');returnValue=true;window.close();</script>"); } else { this.Page.RegisterStartupScript("", "<script>alert('没有相关数据可添加!');</script>"); } } if (this.OperateType == "upd") { int num = this.amAction.Update(data); if (num > 0) { this.Page.RegisterStartupScript("", "<script>alert('修改成功!');returnValue=true;window.close();</script>"); return; } this.Page.RegisterStartupScript("", "<script>alert('没有相关数据可更新!');</script>"); } }
public int Update(OAOfficeResApplicationCollect model) { StringBuilder builder = new StringBuilder(); builder.Append("update OA_OfficeRes_ApplicationCollect set "); builder.Append("iMonth=" + model.iMonth + ","); builder.Append("Remark='" + model.Remark + "'"); builder.Append(" where ACRecordID='" + model.ACRecordID + "'"); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
public OAOfficeResApplicationCollect GetModel(Guid ACRecordID) { StringBuilder builder = new StringBuilder(); builder.Append("select * "); builder.Append(" ACRecordID,AuditState,iYear,iMonth,ApplyType,CorpCode,SumMoney,IsSubmit,UserCode,RecordDate "); builder.Append(" from OA_OfficeRes_ApplicationCollect "); builder.Append(" where ACRecordID='" + ACRecordID + "' "); OAOfficeResApplicationCollect collect = new OAOfficeResApplicationCollect(); DataSet set = publicDbOpClass.DataSetQuary(builder.ToString()); if (set.Tables[0].Rows.Count <= 0) { return(null); } if (set.Tables[0].Rows[0]["ACRecordID"].ToString() != "") { collect.ACRecordID = new Guid(set.Tables[0].Rows[0]["ACRecordID"].ToString()); } if (set.Tables[0].Rows[0]["AuditState"].ToString() != "") { collect.AuditState = int.Parse(set.Tables[0].Rows[0]["AuditState"].ToString()); } if (set.Tables[0].Rows[0]["iYear"].ToString() != "") { collect.iYear = int.Parse(set.Tables[0].Rows[0]["iYear"].ToString()); } if (set.Tables[0].Rows[0]["iMonth"].ToString() != "") { collect.iMonth = int.Parse(set.Tables[0].Rows[0]["iMonth"].ToString()); } collect.ApplyType = set.Tables[0].Rows[0]["ApplyType"].ToString(); collect.CorpCode = set.Tables[0].Rows[0]["CorpCode"].ToString(); if (set.Tables[0].Rows[0]["SumMoney"].ToString() != "") { collect.SumMoney = decimal.Parse(set.Tables[0].Rows[0]["SumMoney"].ToString()); } collect.IsSubmit = set.Tables[0].Rows[0]["IsSubmit"].ToString(); collect.UserCode = set.Tables[0].Rows[0]["UserCode"].ToString(); if (set.Tables[0].Rows[0]["RecordDate"].ToString() != "") { collect.RecordDate = DateTime.Parse(set.Tables[0].Rows[0]["RecordDate"].ToString()); } collect.Remark = set.Tables[0].Rows[0]["Remark"].ToString(); return(collect); }
public int Add(OAOfficeResApplicationCollect model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into OA_OfficeRes_ApplicationCollect("); builder.Append("ACRecordID,AuditState,iYear,iMonth,ApplyType,CorpCode,SumMoney,IsSubmit,UserCode,RecordDate,Remark"); builder.Append(")"); builder.Append(" values ("); builder.Append("'" + model.ACRecordID + "',"); builder.Append(model.AuditState + ","); builder.Append(model.iYear + ","); builder.Append(model.iMonth + ","); builder.Append("'" + model.ApplyType + "',"); builder.Append("'" + model.CorpCode + "',"); builder.Append(model.SumMoney + ","); builder.Append("'" + model.IsSubmit + "',"); builder.Append("'" + model.UserCode + "',"); builder.Append("'" + model.RecordDate + "',"); builder.Append("'" + model.Remark + "'"); builder.Append(")"); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
private OAOfficeResApplicationCollect GetData() { OAOfficeResApplicationCollect oAOfficeResApplicationCollect = new OAOfficeResApplicationCollect(); if (this.OperateType == "upd") { oAOfficeResApplicationCollect.ACRecordID = this.RecordID; } else { oAOfficeResApplicationCollect.ACRecordID = Guid.NewGuid(); } oAOfficeResApplicationCollect.ApplyType = this.DDLApplyType.SelectedValue; oAOfficeResApplicationCollect.AuditState = -1; oAOfficeResApplicationCollect.CorpCode = this.Session["CorpCode"].ToString(); oAOfficeResApplicationCollect.iMonth = ((this.txtMonth.Text.Trim() == "") ? DateTime.Now.Month : int.Parse(this.txtMonth.Text.Trim())); oAOfficeResApplicationCollect.IsSubmit = "0"; oAOfficeResApplicationCollect.iYear = ((this.txtYear.Text.Trim() == "") ? DateTime.Now.Year : int.Parse(this.txtYear.Text.Trim())); oAOfficeResApplicationCollect.RecordDate = DateTime.Now; oAOfficeResApplicationCollect.SumMoney = 0m; oAOfficeResApplicationCollect.UserCode = base.UserCode; oAOfficeResApplicationCollect.Remark = this.txtRemark.Text.Trim(); return(oAOfficeResApplicationCollect); }