protected void btnAdd_Click(object sender, EventArgs e) { HROrgManpowerPlan data = this.GetData(); if (this.OperateType == "add") { int num = this.hrAction.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.hrAction.Update(data); if (num > 0) { this.Page.RegisterStartupScript("", "<script>alert('修改成功!');returnValue=true;window.close();</script>"); return; } this.Page.RegisterStartupScript("", "<script>alert('没有相关数据可更新!');</script>"); } }
public HROrgManpowerPlan GetModel(Guid RecordID) { StringBuilder builder = new StringBuilder(); builder.Append(" select RecordID,PlanName,UserCode,RecordDate,AuditState,CorpCode,Remark "); builder.Append(" from HR_Org_ManpowerPlan "); builder.Append(" where RecordID='" + RecordID + "' "); HROrgManpowerPlan plan = new HROrgManpowerPlan(); DataTable table = publicDbOpClass.DataTableQuary(builder.ToString()); if (table.Rows.Count <= 0) { return(null); } DataRow row = table.Rows[0]; if (row["RecordID"].ToString() != "") { plan.RecordID = new Guid(row["RecordID"].ToString()); } plan.PlanName = row["PlanName"].ToString(); plan.UserCode = row["UserCode"].ToString(); if (row["RecordDate"].ToString() != "") { plan.RecordDate = DateTime.Parse(row["RecordDate"].ToString()); } plan.AuditState = int.Parse(row["AuditState"].ToString()); plan.CorpCode = row["CorpCode"].ToString(); plan.Remark = row["Remark"].ToString(); return(plan); }
private void EditDisplay() { HROrgManpowerPlan model = this.hrAction.GetModel(this.RecordID); if (model != null) { this.LbLayoutName.Text = model.PlanName; this.LbLayoutDate.Text = model.RecordDate.ToShortDateString(); this.LblAddPerson.Text = BooksCommonClass.GetUserName(model.UserCode); } }
public int Update(HROrgManpowerPlan model) { StringBuilder builder = new StringBuilder(); builder.Append(" update HR_Org_ManpowerPlan set "); builder.Append(" PlanName='" + model.PlanName + "', "); builder.Append(" RecordDate='" + model.RecordDate + "', "); builder.Append(" CorpCode='" + model.CorpCode + "', "); builder.Append(" Remark='" + model.Remark + "' "); builder.Append(" where RecordID='" + model.RecordID + "' "); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
public int Add(HROrgManpowerPlan model) { StringBuilder builder = new StringBuilder(); builder.Append(" insert into HR_Org_ManpowerPlan( "); builder.Append(" RecordID,PlanName,UserCode,RecordDate,AuditState,CorpCode,Remark "); builder.Append(" )"); builder.Append(" values ( "); builder.Append(" '" + model.RecordID + "', "); builder.Append(" '" + model.PlanName + "', "); builder.Append(" '" + model.UserCode + "', "); builder.Append(" '" + model.RecordDate + "', "); builder.Append(" '" + model.AuditState + "', "); builder.Append(" '" + model.CorpCode + "', "); builder.Append(" '" + model.Remark + "' "); builder.Append(" ) "); return(publicDbOpClass.ExecSqlString(builder.ToString())); }