protected void BtnAdd_Click(object sender, EventArgs e) { ConstructionLogModel cLM = this.GetCLM(); if (base.Request.QueryString["t"] == "2") { cLM.logID = base.Request.QueryString["LogID"].ToString(); if (WokLog.Update(cLM) == 1) { this.Page.RegisterClientScriptBlock("", "<script languange='javascript'>alert('修改成功!');window.returnValue=true;window.close();</script>"); return; } } else { if (WokLog.Exist(this.txtcode.Text) == 1) { this.Page.RegisterClientScriptBlock("", "<script>alert('编码已存在,重新填写!');</script>"); return; } if (WokLog.Add(cLM, base.Request["pmId"].ToString()) == 1) { this.Page.RegisterClientScriptBlock("", "<script>alert('添加成功!');window.close();</script>"); } } }
protected void BtnDel_Click(object sender, EventArgs e) { string logID = Convert.ToString(this.hdnLogID.Value); if (WokLog.Delete(logID) == 1) { this.js.Text = "alert('删除成功!');"; this.myDataBind(); return; } this.js.Text = "alert('删除错误!');"; }
protected void Page_Load(object sender, EventArgs e) { base.Response.Cache.SetNoStore(); if (!this.Page.IsPostBack) { if (base.Request.QueryString["t"] == "2") { ConstructionLogModel model = WokLog.GetModel(base.Request.QueryString["LogID"].ToString()); this.hdnRecordId.Value = base.Request.QueryString["LogID"].ToString(); this.txtcode.Text = model.code.ToString(); this.txtamweather.Text = model.amweather; this.txtoperations.Text = model.operations; this.txtthisDate.Text = model.thisDate.ToShortDateString(); DateTime thisDate = model.thisDate; int month = thisDate.Month; int year = thisDate.Year; int day = thisDate.Day; switch (ProjectManage_Construction_ConstructionLogAdd.getWeekDay(year, month, day)) { case 1: this.lbWeek.Text = "星期一"; break; case 2: this.lbWeek.Text = "星期二"; break; case 3: this.lbWeek.Text = "星期三"; break; case 4: this.lbWeek.Text = "星期四"; break; case 5: this.lbWeek.Text = "星期五"; break; case 6: this.lbWeek.Text = "星期六"; break; case 7: this.lbWeek.Text = "星期日"; break; } this.txtdaycontent.Text = model.daycontent; this.txtdesign.Text = model.design; this.txtacceptance.Text = model.acceptance; this.txtbeton.Text = model.beton; this.txtdatum.Text = model.datum; this.txtproduct.Text = model.product; this.txtremark.Text = model.remark; this.txtPart.Text = model.part; this.FilesBind(5); return; } if (base.Request.QueryString["t"] == "3") { this.BtnAnnex.Visible = false; ConstructionLogModel model2 = WokLog.GetModel(base.Request.QueryString["LogID"].ToString()); this.txtcode.Text = model2.code.ToString(); this.txtamweather.Text = model2.amweather; this.txtoperations.Text = model2.operations; this.txtthisDate.Text = model2.thisDate.ToShortDateString(); DateTime thisDate2 = model2.thisDate; int month2 = thisDate2.Month; int year2 = thisDate2.Year; int day2 = thisDate2.Day; switch (ProjectManage_Construction_ConstructionLogAdd.getWeekDay(year2, month2, day2)) { case 1: this.lbWeek.Text = "星期一"; break; case 2: this.lbWeek.Text = "星期二"; break; case 3: this.lbWeek.Text = "星期三"; break; case 4: this.lbWeek.Text = "星期四"; break; case 5: this.lbWeek.Text = "星期五"; break; case 6: this.lbWeek.Text = "星期六"; break; case 7: this.lbWeek.Text = "星期日"; break; } this.txtdaycontent.Text = model2.daycontent; this.txtdesign.Text = model2.design; this.txtacceptance.Text = model2.acceptance; this.txtbeton.Text = model2.beton; this.txtdatum.Text = model2.datum; this.txtproduct.Text = model2.product; this.txtremark.Text = model2.remark; this.txtPart.Text = model2.part; this.txtcode.ReadOnly = true; this.txtamweather.ReadOnly = true; this.txtoperations.ReadOnly = true; this.txtthisDate.ReadOnly = true; this.txtdaycontent.ReadOnly = true; this.txtdesign.ReadOnly = true; this.txtacceptance.ReadOnly = true; this.txtbeton.ReadOnly = true; this.txtdatum.ReadOnly = true; this.txtproduct.ReadOnly = true; this.txtremark.ReadOnly = true; this.BtnAdd.Visible = false; this.FilesBind(5); return; } this.hdnRecordId.Value = Convert.ToString(Guid.NewGuid()); this.txtthisDate.Text = DateTime.Today.ToShortDateString(); DateTime today = DateTime.Today; int month3 = today.Month; int year3 = today.Year; int day3 = today.Day; switch (ProjectManage_Construction_ConstructionLogAdd.getWeekDay(year3, month3, day3)) { case 1: this.lbWeek.Text = "星期一"; return; case 2: this.lbWeek.Text = "星期二"; return; case 3: this.lbWeek.Text = "星期三"; return; case 4: this.lbWeek.Text = "星期四"; return; case 5: this.lbWeek.Text = "星期五"; return; case 6: this.lbWeek.Text = "星期六"; return; case 7: this.lbWeek.Text = "星期日"; break; default: return; } } }
private void myDataQuery() { this.dgClass.DataSource = WokLog.GetQuery(this.txtCode.Text, this.txtPart.Text, this.txtOperations.Text, this.QProjectID, this.workdate.Text); this.dgClass.DataBind(); }
private void myDataBind() { this.dgClass.DataSource = WokLog.GetList(string.Format(" ProjectId='{0}'", this.QProjectID)); this.dgClass.DataBind(); }