protected void btnSave_Click(object sender, EventArgs e) { if (this.flag != 0) { base.Response.Redirect(string.Concat(new object[] { "PhotosCheckInEdit.aspx?op=v&prj=", this.ProjectCode, "&pn=", this.ProjectName, "&IntendanceGuid=", this.IntendanceGuid })); return; } EPM_IntendanceInfo intendanceInfo = this.GetIntendanceInfo(); int num = this.IntendanceInfoAction.Update(intendanceInfo); int num2 = this.intendanceMasterAction.Update(this.IntendanceGuid.ToString(), 0, this.hdfusercode.Value); if (num == 1 && num2 == 1) { this.Page.RegisterStartupScript("warn", "<script language=\"JavaScript\">top.ui.tabSuccess({ parentName: '_PhotosCheckInList2' });</script>"); return; } this.Page.RegisterStartupScript("warn", "<script language=\"JavaScript\">top.ui.alert('保存失败');</script>"); }
protected EPM_IntendanceInfo GetIntendanceInfo() { EPM_IntendanceInfo ePM_IntendanceInfo = new EPM_IntendanceInfo(); if (this.opType == "add" || this.opType == "v") { ePM_IntendanceInfo.NoteId = Guid.NewGuid(); } else { ePM_IntendanceInfo.NoteId = this.IntendanceInfoAction.GetModel(this.IntendanceGuid).NoteId; } ePM_IntendanceInfo.IntendanceGuid = this.IntendanceGuid; ePM_IntendanceInfo.AskQuestionsYhdm = base.UserCode; ePM_IntendanceInfo.AskQuestionsDate = new DateTime?(DateTime.Now); ePM_IntendanceInfo.QuestionExplain = this.txtQuestion.Text; ePM_IntendanceInfo.SettleYhdm = this.hdfusercode.Value; if (!ePM_IntendanceInfo.SettleYhdm.Contains("00000000")) { EPM_IntendanceInfo expr_B0 = ePM_IntendanceInfo; expr_B0.SettleYhdm += "00000000,"; } ePM_IntendanceInfo.QuestionTag = new int?(0); return(ePM_IntendanceInfo); }
protected void DataBindToPage() { IntendanceMaster intendanceMaster = this.intendanceMasterAction.GetIntendanceMaster(this.IntendanceGuid); EPM_IntendanceInfo model = this.IntendanceInfoAction.GetModel(this.IntendanceGuid); userManageDb userManageDb = new userManageDb(); if (this.opType != "v" && this.opType != "add") { this.txtQuestionTitle.Text = intendanceMaster.QuestionTitle; this.txtDate.Text = intendanceMaster.BookInDate.ToString("yyyy-MM-dd"); this.ddlType.SelectedValue = intendanceMaster.QuestionTypeId.ToString(); this.txtPerson.Value = WebUtil.GetUserNamesComma(intendanceMaster.SettleYhdm); this.ManagerCode.Value = intendanceMaster.SettleYhdm; this.txtQuestion.Text = model.QuestionExplain; this.InfoGuid = model.NoteId; return; } if (this.opType == "v") { this.lbltype.Visible = true; this.lblQuestionTitle.Visible = true; this.lblDate.Visible = true; this.txtDate.Visible = false; this.ddlType.Visible = false; this.txtPerson.Visible = false; this.txtQuestionTitle.Visible = false; this.Img3.Visible = false; this.lblQuestionTitle.Text = intendanceMaster.QuestionTitle; this.lblDate.Text = intendanceMaster.BookInDate.ToString("yyyy-MM-dd"); this.lbltype.Text = this.intendanceMasterAction.GetQuestionNameById(intendanceMaster.QuestionTypeId); this.lblPerson.Text = userManageDb.GetUserName(intendanceMaster.SettleYhdm); this.InfoGuid = model.NoteId; } }
public int Update(EPM_IntendanceInfo model) { StringBuilder builder = new StringBuilder(); builder.Append("update OPM_EPCM_IntendanceInfo set "); Guid intendanceGuid = model.IntendanceGuid; builder.Append("IntendanceGuid='" + model.IntendanceGuid + "',"); if (model.AskQuestionsYhdm != null) { builder.Append("AskQuestionsYhdm='" + model.AskQuestionsYhdm + "',"); } if (model.AskQuestionsDate.HasValue) { builder.Append("AskQuestionsDate='" + model.AskQuestionsDate + "',"); } if (model.QuestionExplain != null) { builder.Append("QuestionExplain='" + model.QuestionExplain + "',"); } if (model.SettleYhdm != null) { builder.Append("SettleYhdm='" + model.SettleYhdm + "',"); } if (model.SettleToPerson != null) { builder.Append("SettleToPerson='" + model.SettleToPerson + "',"); } if (model.SettleDate.HasValue) { builder.Append("SettleDate='" + model.SettleDate + "',"); } if (model.ToCause != null) { builder.Append("ToCause='" + model.ToCause + "',"); } if (model.SettleExplain != null) { builder.Append("SettleExplain='" + model.SettleExplain + "',"); } if (model.QuestionTag.HasValue) { builder.Append("QuestionTag=" + model.QuestionTag + ","); } int startIndex = builder.ToString().LastIndexOf(","); builder.Remove(startIndex, 1); builder.Append(" where NoteId='" + model.NoteId + "' "); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
protected EPM_IntendanceInfo GetIntendanceInfo() { EPM_IntendanceInfo ePM_IntendanceInfo = new EPM_IntendanceInfo(); string strWhere = " IntendanceGuid='" + this.IntendanceGuid + "'"; DataTable list = this.IntendanceInfoAction.GetList(1, strWhere, "AskQuestionsDate DESC "); ePM_IntendanceInfo.NoteId = new Guid(list.Rows[0]["NoteId"].ToString()); ePM_IntendanceInfo.IntendanceGuid = this.IntendanceGuid; ePM_IntendanceInfo.SettleDate = new DateTime?(DateTime.Now); ePM_IntendanceInfo.SettleExplain = this.txtSettleExplain.Text.Trim(); ePM_IntendanceInfo.SettleYhdm = base.UserCode; ePM_IntendanceInfo.SettleToPerson = this.hdfusercode.Value; ePM_IntendanceInfo.ToCause = this.txtToCause.Text.Trim(); ePM_IntendanceInfo.QuestionTag = new int?(1); return(ePM_IntendanceInfo); }
public EPM_IntendanceInfo GetModel(Guid IntendanceGuid) { StringBuilder builder = new StringBuilder(); builder.Append("select top 1 "); builder.Append(" NoteId,IntendanceGuid,AskQuestionsYhdm,AskQuestionsDate,QuestionExplain,SettleYhdm,SettleToPerson,SettleDate,ToCause,SettleExplain,QuestionTag "); builder.Append(" from OPM_EPCM_IntendanceInfo "); builder.Append(" where IntendanceGuid='" + IntendanceGuid + "' order by AskQuestionsDate desc "); EPM_IntendanceInfo info = new EPM_IntendanceInfo(); DataSet set = publicDbOpClass.DataSetQuary(builder.ToString()); if (set.Tables[0].Rows.Count <= 0) { return(null); } if (set.Tables[0].Rows[0]["NoteId"].ToString() != "") { info.NoteId = new Guid(set.Tables[0].Rows[0]["NoteId"].ToString()); } if (set.Tables[0].Rows[0]["IntendanceGuid"].ToString() != "") { info.IntendanceGuid = new Guid(set.Tables[0].Rows[0]["IntendanceGuid"].ToString()); } info.AskQuestionsYhdm = set.Tables[0].Rows[0]["AskQuestionsYhdm"].ToString(); if (set.Tables[0].Rows[0]["AskQuestionsDate"].ToString() != "") { info.AskQuestionsDate = new DateTime?(DateTime.Parse(set.Tables[0].Rows[0]["AskQuestionsDate"].ToString())); } info.QuestionExplain = set.Tables[0].Rows[0]["QuestionExplain"].ToString(); info.SettleYhdm = set.Tables[0].Rows[0]["SettleYhdm"].ToString(); info.SettleToPerson = set.Tables[0].Rows[0]["SettleToPerson"].ToString(); if (set.Tables[0].Rows[0]["SettleDate"].ToString() != "") { info.SettleDate = new DateTime?(DateTime.Parse(set.Tables[0].Rows[0]["SettleDate"].ToString())); } info.ToCause = set.Tables[0].Rows[0]["ToCause"].ToString(); info.SettleExplain = set.Tables[0].Rows[0]["SettleExplain"].ToString(); if (set.Tables[0].Rows[0]["QuestionTag"].ToString() != "") { info.QuestionTag = new int?(int.Parse(set.Tables[0].Rows[0]["QuestionTag"].ToString())); } return(info); }
public static string getJson(string IntendanceGuid, int flag) { StringBuilder builder = new StringBuilder(); builder.Remove(0, builder.Length); if (flag == 0) { builder.Append("SELECT a.*, b.v_xm as xm FROM dbo.OPM_EPCM_IntendanceInfo as a INNER JOIN dbo.PT_yhmc as b ON a.SettleYhdm = b.v_yhdm WHERE a.IntendanceGuid='" + IntendanceGuid + "' ORDER BY a.AskQuestionsDate DESC"); } else { builder.Append("SELECT a.*, b.v_xm as xm FROM dbo.OPM_EPCM_IntendanceInfo as a INNER JOIN dbo.PT_yhmc as b ON a.SettleYhdm = b.v_yhdm WHERE a.IntendanceGuid='" + IntendanceGuid + "'"); builder.Append(" AND a.NoteId != (SELECT TOP 1 NoteId FROM dbo.OPM_EPCM_IntendanceInfo WHERE IntendanceGuid='" + IntendanceGuid + "' ORDER BY AskQuestionsDate DESC )"); builder.Append(" ORDER BY a.AskQuestionsDate DESC"); } List <EPM_IntendanceInfo> tlInfos = new List <EPM_IntendanceInfo>(); DataTable table = publicDbOpClass.DataTableQuary(builder.ToString()); try { foreach (DataRow row in table.Rows) { EPM_IntendanceInfo item = new EPM_IntendanceInfo(); Guid noteId = item.NoteId; item.NoteId = new Guid(row["NoteId"].ToString()); Guid intendanceGuid = item.IntendanceGuid; item.IntendanceGuid = new Guid(row["IntendanceGuid"].ToString()); item.QuestionExplain = (row["QuestionExplain"] as string) ?? string.Empty; item.ToCause = (row["ToCause"] as string) ?? string.Empty; item.SettleExplain = (row["SettleExplain"] as string) ?? string.Empty; item.SettleYhdm = (row["xm"] as string) ?? string.Empty; item.Sdate = Convert.ToDateTime(row["SettleDate"]).ToString() ?? string.Empty; tlInfos.Add(item); } } catch (Exception exception) { throw exception; } return(buildJson(tlInfos)); }
protected void DataBindToPage() { IntendanceMaster intendanceMaster = this.intendanceMasterAction.GetIntendanceMaster(this.IntendanceGuid); EPM_IntendanceInfo model = this.IntendanceInfoAction.GetModel(this.IntendanceGuid); this.txtQuestionTitle.Text = intendanceMaster.QuestionTitle; this.txtDate.Text = intendanceMaster.BookInDate.ToString("yyyy-MM-dd"); this.lbltype.Text = this.intendanceMasterAction.GetQuestionNameById(intendanceMaster.QuestionTypeId); new userManageDb(); string userNamesComma = WebUtil.GetUserNamesComma(intendanceMaster.SettleYhdm); this.txtPerson.Text = userNamesComma; this.hdfusercode.Value = intendanceMaster.SettleToPerson; this.txtQuestion.Text = model.QuestionExplain; if (this.flag == 0) { this.txtSettleExplain.Text = model.SettleExplain; if (!string.IsNullOrEmpty(intendanceMaster.SettleToPerson)) { this.txtToPerson.Value = WebUtil.GetUserNamesComma(intendanceMaster.SettleToPerson); } } else { this.txtSettleExplain.Visible = false; this.lblSettleExplain.Visible = true; this.txtToCause.Visible = false; this.lblToCause.Visible = true; this.txtToPerson.Visible = false; this.lblToPerson.Visible = true; this.Img3.Visible = false; if (!string.IsNullOrEmpty(intendanceMaster.SettleToPerson)) { this.lblToPerson.Text = WebUtil.GetUserNamesComma(intendanceMaster.SettleToPerson); } this.lblSettleExplain.Text = model.SettleExplain; this.lblToCause.Text = model.ToCause; this.lbl1.Text = userNamesComma + "解决问题的回复时间 " + model.SettleDate; } this.InfoGuid = model.NoteId; }
protected void btnSettled_Click(object sender, EventArgs e) { if (this.flag == 0) { if (!(this.txtSettleExplain.Text != "")) { this.js.Text = "alert('解决情况不能为空!')"; return; } EPM_IntendanceInfo intendanceInfo = this.GetIntendanceInfo(); int num = this.IntendanceInfoAction.Update(intendanceInfo); int num2 = this.intendanceMasterAction.Update(this.IntendanceGuid.ToString(), 2); if (num != 1 || num2 != 1) { this.Page.RegisterStartupScript("warn", "<script language=\"JavaScript\">top.ui.alert('保存失败');</script>"); return; } if (this.intendanceMasterAction.DelDoList("2", this.IntendanceGuid.ToString(), base.UserCode) == 1 && this.intendanceMasterAction.AddDoList("1", this.IntendanceGuid.ToString(), this.intendanceMasterAction.GetIntendanceMaster(this.IntendanceGuid).OpYhdm) == 1) { this.Page.RegisterStartupScript("warn", "<script language=\"JavaScript\">top.ui.tabSuccess({ parentName: '_PhotosCheckInList2' });</script>"); return; } } else { int num3 = this.intendanceMasterAction.Update(this.IntendanceGuid.ToString(), 3); if (num3 == 1) { if (this.intendanceMasterAction.DelDoList("1", this.IntendanceGuid.ToString(), base.UserCode) == 1) { this.Page.RegisterStartupScript("warn", "<script language=\"JavaScript\">top.ui.tabSuccess({ parentName: '_PhotosCheckInList2' });</script>"); return; } } else { this.Page.RegisterStartupScript("warn", "<script language=\"JavaScript\">top.ui.alert('保存失败');</script>"); } } }
public int Add(EPM_IntendanceInfo model, string userCode) { StringBuilder builder = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); StringBuilder builder3 = new StringBuilder(); Guid noteId = model.NoteId; builder2.Append("NoteId,"); builder3.Append("'" + model.NoteId + "',"); Guid intendanceGuid = model.IntendanceGuid; builder2.Append("IntendanceGuid,"); builder3.Append("'" + model.IntendanceGuid + "',"); if (model.AskQuestionsYhdm != null) { builder2.Append("AskQuestionsYhdm,"); builder3.Append("'" + model.AskQuestionsYhdm + "',"); } if (model.AskQuestionsDate.HasValue) { builder2.Append("AskQuestionsDate,"); builder3.Append("'" + model.AskQuestionsDate + "',"); } if (model.QuestionExplain != null) { builder2.Append("QuestionExplain,"); builder3.Append("'" + model.QuestionExplain + "',"); } if (model.SettleYhdm != null) { builder2.Append("SettleYhdm,"); builder3.Append("'" + model.SettleYhdm + "',"); } if (model.SettleToPerson != null) { builder2.Append("SettleToPerson,"); builder3.Append("'" + model.SettleToPerson + "',"); } if (model.SettleDate.HasValue) { builder2.Append("SettleDate,"); builder3.Append("'" + model.SettleDate + "',"); } if (model.ToCause != null) { builder2.Append("ToCause,"); builder3.Append("'" + model.ToCause + "',"); } if (model.SettleExplain != null) { builder2.Append("SettleExplain,"); builder3.Append("'" + model.SettleExplain + "',"); } if (model.QuestionTag.HasValue) { builder2.Append("QuestionTag,"); builder3.Append(model.QuestionTag + ","); } builder.Append("insert into OPM_EPCM_IntendanceInfo ("); builder.Append(builder2.ToString().Remove(builder2.Length - 1)); builder.Append(")"); builder.Append(" values ("); builder.Append(builder3.ToString().Remove(builder3.Length - 1)); builder.Append(")"); builder.Append(string.Concat(new object[] { " update OPM_EPCM_IntendancePhotoList set InfoGuid='", model.NoteId, "' where InfoGuid ='00000000-0000-0000-0000-000000000000' and OPyhdm='", userCode, "' " })); return(publicDbOpClass.ExecSqlString(builder.ToString())); }