| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace HySoft.BaseCallCenter.Web.workordermanage.workorderset
- {
- public partial class workbuttonmanageEdit : BasePage
- {
- int id = 0;
- BLL.T_Wo_WorkOrderButton WorkOrdeButton = new BLL.T_Wo_WorkOrderButton();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- if (Action == "addedit")
- {
- if (Request.QueryString["id"] != null)
- {
- Model.T_Wo_WorkOrderButton model = new Model.T_Wo_WorkOrderButton();
- id = Convert.ToInt32(Request.QueryString["id"].ToString());
- model = WorkOrdeButton.GetModel(id);
- F_ParamDes.Text = model.F_Des;//描述
- textF_Sort.Text = model.F_Sort.ToString();//排序
- F_ParamCode.Text = model.F_Name;//状态名称
- F_ParamValue.Text = model.F_Code;
- }
- }
- }
- }
- /// <summary>
- /// 处理类型新增还是修改
- /// </summary>
- public string Action
- {
- get
- {
- if (Request.QueryString["action"] != null)
- {
- return Request.QueryString["action"].ToString().ToLower();
- }
- else
- {
- return "add";
- }
- }
- }
- /// <summary>
- /// 添加用户信息
- /// </summary>
- /// <returns></returns>
- public bool Add()
- {
- Model.T_Wo_WorkOrderButton model = new Model.T_Wo_WorkOrderButton();
- model.F_Des = F_ParamDes.Text.Trim();//描述
- model.F_Sort = Convert.ToInt32(textF_Sort.Text.Trim());//排序
- model.F_Name = F_ParamCode.Text.Trim();//状态名称
- model.F_Code = F_ParamValue.Text.Trim();
- model.F_DeleteFlag = 0;//是否删除
- bool result = WorkOrdeButton.Add(model);
- return result;
- }
- /// <summary>
- /// 修改用户信息
- /// </summary>
- /// <returns></returns>
- public bool Edit()
- {
- Model.T_Wo_WorkOrderButton model = new Model.T_Wo_WorkOrderButton();
- model.F_Des = F_ParamDes.Text.Trim();//描述
- model.F_Sort = Convert.ToInt32(textF_Sort.Text.Trim());//排序
- model.F_Name = F_ParamCode.Text.Trim();//状态名称
- model.F_Code = F_ParamValue.Text.Trim();
- model.F_DeleteFlag = 0;
- model.F_ButtonId =Convert.ToInt32(Request.QueryString["id"].ToString());
- bool result = WorkOrdeButton.Update(model);
- return result;
- }
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- try
- {
- bool result;
- string a = Request.QueryString["id"];
- if (string.IsNullOrEmpty(a) || a=="0")
- {
- InsertOptLogs(0, 0, "操作成功!workbuttonmanageEdit.aspx页面,添加操作。", 0);
- result = Add();
- }
- else
- {
- InsertOptLogs(0, 0, "操作成功!workbuttonmanageEdit.aspx页面,修改操作。", 0);
- result = Edit();
- }
- MessageBoxToWindow("提交成功", "提示", "success");
- }
- catch (Exception ex)
- {
- InsertOptLogs(0, 0, "操作异常!workbuttonmanageEdit.aspx页面,异常信息:"+ex.ToString(), 2);
- MessageBoxToWindow("异常信息", ex.Message, "catch");
- }
- }
- /// <summary>
- /// 弹出对话框
- /// </summary>
- /// <param name="title"></param>
- /// <param name="content"></param>
- /// <param name="type"></param>
- public void MessageBoxToWindow(string title, string content, string type)
- {
- string script = "";
- switch (type)
- {
- case "error"://失败
- type = "warning";
- script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
- break;
- case "success"://成功
- type = "info";
- script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
- break;
- case "catch"://异常
- type = "error";
- script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
- break;
- default:
- type = "question";
- break;
- }
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
- }
- }
- }
|