protected void btnSave_Click(object sender, EventArgs e) { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); if (ckFault.Checked) { string ftID = ""; List <String> commandlist = new List <String>(); string query = "select * from HT_EQ_FAULT_DB where Error_name = '" + txtName.Text + "' and eqp_TYpe = '" + listEqType.SelectedValue + "' and SPECIFIC_LOCATION = '" + txtLocation.Text + "' and SECTION_CODE = '" + listSection.SelectedValue + "' and FAULT_TYPE1 = '" + listStyle1.SelectedValue + "' and FAULT_TYPE2 = '" + listStyle2.SelectedValue + "' and FAULT_TYPE3 = '" + listStyle3.SelectedValue + "' and FAULT_TYPE4 = '" + listStyle4.SelectedValue + "' and FAULT_TYPE5 = '" + listStyle5.SelectedValue + "' and FAULT_TYPE6 = '" + listStyle6.SelectedValue + "' and SCEAN = '" + txtScean.Text + "' and ERROR_DESCRIPTION = '" + txtDescpt.Text + "' and FAILURE_CAUSE = '" + txtReason.Text + "' and SOLUTION = '" + txtSolution.Text + "' and EQUIP_CODE = '" + listEq.SelectedValue + "'"; query = query.Replace("= ''", "is null"); DataSet data = opt.CreateDataSetOra(query); if (data != null && data.Tables[0].Rows.Count > 0) { ftID = data.Tables[0].Rows[0]["ID"].ToString(); } else { ftID = opt.GetSegValue("select fault_id_seq.nextval from dual", "nextval"); string[] seg1 = { "ID", "ERROR_NAME", "EQP_TYPE", "SPECIFIC_LOCATION", "SECTION_CODE", "FAULT_TYPE1", "FAULT_TYPE2", "FAULT_TYPE3", "FAULT_TYPE4", "FAULT_TYPE5", "FAULT_TYPE6", "SCEAN", "ERROR_DESCRIPTION", "FAILURE_CAUSE", "SOLUTION", "CREATE_TIME", "EQUIP_CODE", "EDITOR" }; string[] value1 = { ftID, txtName.Text, listEqType.SelectedValue, txtLocation.Text, listSection.SelectedValue, listStyle1.SelectedValue, listStyle2.SelectedValue, listStyle3.SelectedValue, listStyle4.SelectedValue, listStyle5.SelectedValue, listStyle6.SelectedValue, txtScean.Text, txtDescpt.Text, txtReason.Text, txtSolution.Text, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), listEq.SelectedValue, ((MSYS.Data.SysUser)Session["User"]).text }; commandlist.Add(opt.InsertDatastr(seg1, value1, "HT_EQ_FAULT_DB")); } string status = "5"; string[] seg = { "EQUIPMENT_ID", "EXE_TIME", "RESPONER", "MECH_AREA", "IS_EMG", "REASON", "CONTENT", "FAULT_ID", "STATUS", "create_time" }; string[] value = { listEq.SelectedValue, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), listOptor.SelectedValue, listArea.SelectedValue, Convert.ToInt16(ckFault.Checked).ToString(), txtReasons.Text, txtContent.Text, ftID, status, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }; commandlist.Add(opt.InsertDatastr(seg, value, "HT_EQ_RP_PLAN_DETAIL")); string log_message = opt.TransactionCommand(commandlist) == "Success" ? "应急维修记录成功" : "应急维修记录失败"; log_message += "--详情:" + string.Join(",", value); InsertTlog(log_message); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "alert('非应急维修请上报!!');", true); } }
protected void btnSumit_Click(object sender, EventArgs e) { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); List <string> commandlist = new List <string>(); commandlist.Add("update HT_EQ_MT_PLAN_DETAIL set STATUS = '5',CONTENT = '故障己上报' where id = '" + txtCode.Text + "'"); string[] seg = { "EQUIPMENT_ID", "EXE_TIME", "RESPONER", "MECH_AREA", "IS_EMG", "REASON", "CONTENT", "STATUS" }; string[] value = { listEq.SelectedValue, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), listOptor.SelectedValue, listArea.SelectedValue, Convert.ToInt16(ckFault.Checked).ToString(), txtResults.Text, txtRecord.Text, "-1" }; commandlist.Add(opt.InsertDatastr(seg, value, "HT_EQ_RP_PLAN_DETAIL")); string log_message = opt.TransactionCommand(commandlist) == "Success" ? "维保上报故障成功" : "维保上报故障失败"; log_message += "--详情:" + string.Join(",", value); InsertTlog(log_message); bindGrid(); }
protected void btnModify1_Click(object sender, EventArgs e) { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string[] seg = { "mattree_code", "MATTREE_NAME", "PARENT_CODE", "IS_VALID" }; string[] value = { txtCode1.Text, txtName1.Text, listPrt1.SelectedValue, Convert.ToInt16(ckValid1.Checked).ToString() }; List <String> commandlist = new List <String>(); commandlist.Add("delete from HT_PUB_MATTREE where MATTREE_CODE = '" + txtCode1.Text + "'"); commandlist.Add(opt.InsertDatastr(seg, value, "HT_PUB_MATTREE")); string log_message = opt.TransactionCommand(commandlist) == "Success" ? "分类修改成功" : "分类修改失败"; log_message += ",分类信息:" + string.Join(",", value); InsertTlog(log_message); bindGrid(txtCode1.Text); tvHtml = InitTree(); ScriptManager.RegisterStartupScript(UpdatePanel4, this.Page.GetType(), "init", " initTree();", true); }
protected void btnCreate_Click(object sender, EventArgs e) { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string query = "select * from ht_eq_lb_plan_detail where MAIN_ID = '" + listModel.SelectedValue + "' and is_del = '0'"; DataSet data = opt.CreateDataSetOra(query); List <string> commandlist = new List <string>(); if (data != null && data.Tables[0].Rows.Count > 0) { foreach (DataRow row in data.Tables[0].Rows) { string[] seg = { "section", "equipment_id", "Remark", "CREATE_TIME", "MAIN_ID", "EXP_FINISH_TIME" }; string[] value = { row["section"].ToString(), row["equipment_id"].ToString(), row["Remark"].ToString(), System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), txtCode.Text, System.DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd") }; commandlist.Add(opt.InsertDatastr(seg, value, "ht_eq_lb_plan_detail")); } string log_message = opt.TransactionCommand(commandlist) == "Success" ? "按模版生成维保计划成功" : "按模版生成维保计划失败"; log_message += ",计划ID号:" + txtCode.Text; InsertTlog(log_message); } bindGrid2(txtCode.Text); }
protected void createGridView() { string query = createQuery(listSection1.SelectedValue); hideQuery.Value = query; if (query != "") { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); DataSet data = opt.CreateDataSetOra(query); GridView1.Columns.Clear(); TemplateField customField = new TemplateField(); ////增加当前选择列 customField = new TemplateField(); customField.ShowHeader = true; customField.HeaderTemplate = new MSYS.GridViewTemplate(DataControlRowType.Header, "选择", ""); customField.ItemTemplate = new MSYS.GridViewTemplate(DataControlRowType.DataRow, "sel", "CheckBox"); ViewState["ck_sel"] = true; GridView1.Columns.Add(customField); /////增加路径名列 customField = new TemplateField(); customField.ShowHeader = true; customField.HeaderTemplate = new MSYS.GridViewTemplate(DataControlRowType.Header, "路径名称", ""); customField.ItemTemplate = new MSYS.GridViewTemplate(DataControlRowType.DataRow, "Pathname", "TextBox"); ViewState["txt_Pathname"] = true; GridView1.Columns.Add(customField); /////增加路径编码 customField = new TemplateField(); customField.ShowHeader = true; customField.HeaderTemplate = new MSYS.GridViewTemplate(DataControlRowType.Header, "路径编码", ""); customField.ItemTemplate = new MSYS.GridViewTemplate(DataControlRowType.DataRow, "Pathcode", "TextBox"); ViewState["txt_Pathcode"] = true; GridView1.Columns.Add(customField); //增加节点列 for (int j = 2; j < data.Tables[0].Columns.Count - 2; j++) { customField = new TemplateField(); customField.ShowHeader = true; customField.HeaderTemplate = new MSYS.GridViewTemplate(DataControlRowType.Header, data.Tables[0].Columns[j].ColumnName, ""); customField.ItemTemplate = new MSYS.GridViewTemplate(DataControlRowType.DataRow, j.ToString(), "CheckBox"); ViewState["ck_" + j.ToString()] = true; GridView1.Columns.Add(customField); } //增加保存按钮 MSYS.GridViewTemplate.SetButtonClickEvent((object sender, EventArgs e) => { Button btn = (Button)sender; GridView gv = (GridView)btn.NamingContainer.DataKeysContainer; GridViewRow gvr = (GridViewRow)btn.NamingContainer; int index = gvr.RowIndex; string sectioncode = gv.DataKeys[index].Values[0].ToString(); string opathcode = gv.DataKeys[index].Values[1].ToString(); string[] seg = { "SECTION_CODE", "PATHCODE", "PATHNAME", "CREATE_TIME", "IS_DEL" }; string pathcode = ""; for (int i = 3; i < gv.Columns.Count - 1; i++) { pathcode += Convert.ToInt16(((CheckBox)gvr.FindControl("ck_" + (i - 1).ToString())).Checked).ToString(); } ((TextBox)gvr.FindControl("txt_Pathcode")).Text = pathcode; string[] value = { sectioncode, pathcode, ((TextBox)gvr.FindControl("txt_Pathname")).Text, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "0" }; List <String> commandlist = new List <String>(); commandlist.Add("delete from HT_PUB_PATH_SECTION where SECTION_CODE = '" + sectioncode + "' and PATHCODE = '" + opathcode + "'"); commandlist.Add(opt.InsertDatastr(seg, value, "HT_PUB_PATH_SECTION")); opt.TransactionCommand(commandlist); }); customField = new TemplateField(); customField.ShowHeader = true; customField.HeaderTemplate = new MSYS.GridViewTemplate(DataControlRowType.Header, "操作", ""); customField.ItemTemplate = new MSYS.GridViewTemplate(DataControlRowType.DataRow, "Grid1Save", "Button"); ViewState["btn_Grid1Save"] = true; GridView1.Columns.Add(customField); } }