protected void btnSave_Click(object sender, EventArgs e) { inputReceiptYear inputReceiptYear = new inputReceiptYear(); inputReceiptAction inputReceiptAction = new inputReceiptAction(); inputReceiptYear.ExaminePeople = this.txtExaminePeople.Text; inputReceiptYear.ExamineTime = DateTime.Parse(this.txtExamineTime.Text); inputReceiptYear.Remark = this.txtRemark.Text; inputReceiptYear.SerialNumber = this.txtSerialNumber.Text; inputReceiptYear.TabPeople = this.txtTabPeople.Text; inputReceiptYear.TabTime = DateTime.Parse(this.txtTabTime.Text); inputReceiptYear.PrjCode = this.prjCode; inputReceiptYear.PlanYear = this.ddlPlanYear.SelectedValue; if (this.ViewState["MAINID"] != null) { inputReceiptYear.MainId = int.Parse(this.ViewState["MAINID"].ToString()); } if (inputReceiptAction.SaveYearPlan(inputReceiptYear)) { this.js.Text = "alert(\"操作成功!\");"; } else { this.js.Text = "alert(\"操作失败!\");"; } this.BindData(inputReceiptYear); }
private void BindData(inputReceiptYear objInfo) { this.txtExaminePeople.Text = objInfo.ExaminePeople; this.txtExamineTime.Text = objInfo.ExamineTime.ToShortDateString(); this.txtExamineTime.ReadOnly = true; this.txtRemark.Text = objInfo.Remark; this.txtSerialNumber.Text = objInfo.SerialNumber; this.txtTabPeople.Text = objInfo.TabPeople; this.txtTabTime.Text = objInfo.TabTime.ToShortDateString(); this.ddlPlanYear.SelectedValue = objInfo.PlanYear; }
public inputReceiptYear GetYearPlanInfo(string MainID) { string sqlString = "select * from Prj_IncomeDevotionPlan where MainID=" + MainID; inputReceiptYear year = new inputReceiptYear(); if (MainID != "") { foreach (DataRow row in publicDbOpClass.DataTableQuary(sqlString).Rows) { year = this.FormatToModel(row); } } return(year); }
public bool SaveYearPlan(inputReceiptYear objInfo) { string sqlString = ""; if (objInfo.MainId == 0) { objInfo.MainId = this.GetNewMainId(); string str2 = "insert into Prj_IncomeDevotionPlan values(" + objInfo.MainId.ToString(); string str3 = str2 + ",'" + objInfo.PrjCode + "','" + objInfo.SerialNumber + "','" + objInfo.PlanYear; string str4 = str3 + "','" + objInfo.TabPeople + "','" + objInfo.TabTime.ToShortDateString() + "','"; sqlString = (str4 + objInfo.ExaminePeople + "','" + objInfo.ExamineTime.ToShortDateString() + "','") + objInfo.Remark + "')"; } else { string str5 = "update Prj_IncomeDevotionPlan set SerialNumber='" + objInfo.SerialNumber; string str6 = str5 + "',PlanYear='" + objInfo.PlanYear + "',TabPeople='" + objInfo.TabPeople + "',TabTime='"; string str7 = str6 + objInfo.TabTime.ToString() + "',ExaminePeople='" + objInfo.ExaminePeople + "',ExamineTime='"; sqlString = (str7 + objInfo.ExamineTime.ToString() + "',Remark='" + objInfo.Remark + "' where mainid=") + objInfo.MainId.ToString(); } return(publicDbOpClass.NonQuerySqlString(sqlString)); }
private void BindData() { inputReceiptAction inputReceiptAction = new inputReceiptAction(); inputReceiptYear inputReceiptYear = new inputReceiptYear(); if (this.ViewState["MAINID"] != null) { inputReceiptYear = inputReceiptAction.GetYearPlanInfo(this.ViewState["MAINID"].ToString()); } else { inputReceiptYear = inputReceiptAction.GetYearPlanInfo(""); } this.txtExaminePeople.Text = inputReceiptYear.ExaminePeople; this.txtExamineTime.Text = inputReceiptYear.ExamineTime.ToShortDateString(); this.txtExamineTime.ReadOnly = true; this.txtRemark.Text = inputReceiptYear.Remark; this.txtSerialNumber.Text = inputReceiptYear.SerialNumber; this.txtTabPeople.Text = inputReceiptYear.TabPeople; this.txtTabTime.Text = inputReceiptYear.TabTime.ToShortDateString(); }
private void BindDropDownList(string MainID) { inputReceiptAction inputReceiptAction = new inputReceiptAction(); DataTable existPlanYear = inputReceiptAction.GetExistPlanYear(""); string text = ""; for (int i = DateTime.Today.Year - 10; i < DateTime.Today.Year + 10; i++) { bool flag = false; for (int j = 0; j < existPlanYear.Rows.Count; j++) { if (MainID == "") { if (i.ToString() == existPlanYear.Rows[j][0].ToString()) { flag = true; } } else { inputReceiptYear yearPlanInfo = inputReceiptAction.GetYearPlanInfo(MainID); text = yearPlanInfo.PlanYear; if (i.ToString() == existPlanYear.Rows[j][0].ToString() && i.ToString() != yearPlanInfo.PlanYear) { flag = true; } } } if (!flag) { this.ddlPlanYear.Items.Add(new System.Web.UI.WebControls.ListItem(i.ToString() + "年度", i.ToString())); } } if (text != "") { this.ddlPlanYear.SelectedValue = text; } }
public bool CheckDataIsAtDb(inputReceiptYear objInfo) { return(publicDbOpClass.DataTableQuary(string.Format("select * from Prj_IncomeDevotionPlan where PrjCode='{0}' and PlanYear='{1}'", objInfo.PrjCode, objInfo.PlanYear)).Rows.Count > 0); }