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 (publicDbOpClass.Update(cLM) == 1) { this.Page.RegisterClientScriptBlock("", "<script languange='javascript'>parent.desktop.flowclass.location=parent.desktop.flowclass.location;alert('修改成功!');window.returnValue=true;top.frameWorkArea.window.desktop.getActive().close();</script>"); return; } } else { if (publicDbOpClass.Exist(this.txtcode.Text, base.Request["pmId"].ToString()) == 1) { this.Page.RegisterClientScriptBlock("", "<script>alert('编码已存在,重新填写!');</script>"); return; } if (publicDbOpClass.Add(cLM, base.Request["pmId"].ToString()) == 1) { this.Page.RegisterClientScriptBlock("", "<script>parent.desktop.flowclass.location=parent.desktop.flowclass.location;alert('添加成功!');top.frameWorkArea.window.desktop.getActive().close();</script>"); } } }
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>"); } } }
public static int Update(ConstructionLogModel mdl) { object obj2 = (("" + "update pm_Construction_Log set ") + "code='" + mdl.code + "',") + "part='" + mdl.part + "',"; object obj3 = (((string.Concat(new object[] { obj2, "attendance=", mdl.attendance, "," }) + "temperature='" + mdl.temperature + "',") + "amweather='" + mdl.amweather + "',") + "pmweather='" + mdl.pmweather + "',") + "operations='" + mdl.operations + "',"; return(ExecSqlString((((((((((string.Concat(new object[] { obj3, "thisDate='", mdl.thisDate, "'," }) + "daycontent='" + mdl.daycontent + "',") + "design='" + mdl.design + "',") + "acceptance='" + mdl.acceptance + "',") + "beton='" + mdl.beton + "',") + "datum='" + mdl.datum + "',") + "product='" + mdl.product + "',") + "situation='" + mdl.situation + "',") + "remark='" + mdl.remark + "'") + " where logID='" + mdl.logID + "'").ToString())); }
public static ConstructionLogModel GetModel(string logID) { string str = ""; str = (str + "select * from pm_Work_Log ") + " where logID='" + logID + "'"; ConstructionLogModel model = new ConstructionLogModel(); DataSet set = publicDbOpClass.DataSetQuary(str.ToString()); model.logID = logID; if (set.Tables[0].Rows.Count <= 0) { return(null); } if (set.Tables[0].Rows[0]["ProjectId"].ToString() != "") { model.ProjectId = int.Parse(set.Tables[0].Rows[0]["ProjectId"].ToString()); } model.code = set.Tables[0].Rows[0]["code"].ToString(); model.part = set.Tables[0].Rows[0]["part"].ToString(); if (set.Tables[0].Rows[0]["attendance"].ToString() != "") { model.attendance = int.Parse(set.Tables[0].Rows[0]["attendance"].ToString()); } model.temperature = set.Tables[0].Rows[0]["temperature"].ToString(); model.amweather = set.Tables[0].Rows[0]["amweather"].ToString(); model.pmweather = set.Tables[0].Rows[0]["pmweather"].ToString(); model.operations = set.Tables[0].Rows[0]["operations"].ToString(); if (set.Tables[0].Rows[0]["thisDate"].ToString() != "") { model.thisDate = DateTime.Parse(set.Tables[0].Rows[0]["thisDate"].ToString()); } model.daycontent = set.Tables[0].Rows[0]["daycontent"].ToString(); model.design = set.Tables[0].Rows[0]["design"].ToString(); model.acceptance = set.Tables[0].Rows[0]["acceptance"].ToString(); model.beton = set.Tables[0].Rows[0]["beton"].ToString(); model.datum = set.Tables[0].Rows[0]["datum"].ToString(); model.product = set.Tables[0].Rows[0]["product"].ToString(); model.situation = set.Tables[0].Rows[0]["situation"].ToString(); model.remark = set.Tables[0].Rows[0]["remark"].ToString(); return(model); }
public static int Add(ConstructionLogModel mdl) { object obj2 = (((((((((("" + "insert into pm_Work_Log(" + "logID,ProjectId,code,part,attendance,temperature,amweather,pmweather,operations,thisDate,daycontent,design,acceptance,beton,datum,product,situation,remark") + ")" + " values (") + "'" + mdl.logID + "',") + mdl.ProjectId + ",") + "'" + mdl.code + "',") + "'" + mdl.part + "',") + mdl.attendance + ",") + "'" + mdl.temperature + "',") + "'" + mdl.amweather + "',") + "'" + mdl.pmweather + "',") + "'" + mdl.operations + "',"; return(publicDbOpClass.ExecSqlString((((((((((string.Concat(new object[] { obj2, "'", mdl.thisDate, "'," }) + "'" + mdl.daycontent + "',") + "'" + mdl.design + "',") + "'" + mdl.acceptance + "',") + "'" + mdl.beton + "',") + "'" + mdl.datum + "',") + "'" + mdl.product + "',") + "'" + mdl.situation + "',") + "'" + mdl.remark + "'") + ")").ToString())); }
protected void Page_Load(object sender, EventArgs e) { base.Response.Cache.SetNoStore(); if (!this.Page.IsPostBack) { if (base.Request.QueryString["t"] == "2") { ConstructionLogModel model = ConstructionLog.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.Literal1.Visible = false; this.FileLink1.MID = 1913; this.FileLink1.FID = this.hdnRecordId.Value; this.FileLink1.Type = 1; return; } if (base.Request.QueryString["t"] == "3") { ConstructionLogModel model2 = ConstructionLog.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.txtPart.ReadOnly = true; this.BtnAdd.Visible = false; this.FileLink1.MID = 1913; this.FileLink1.FID = model2.logID.ToString(); this.FileLink1.Type = 1; this.FileLink1.Visible = false; this.Literal1.Text = FileView.FilesBind(1913, model2.logID.ToString()); return; } this.hdnRecordId.Value = Convert.ToString(Guid.NewGuid()); this.txtthisDate.Text = DateTime.Today.ToShortDateString(); this.Literal1.Visible = false; this.FileLink1.MID = 1913; this.FileLink1.FID = this.hdnRecordId.Value; this.FileLink1.Type = 1; 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; } } }