using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using HySoft.Common;
namespace HySoft.BaseCallCenter.Web.sysmanage
{
public partial class functionanniuedit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["getPuction"].ToString() == "Edit")
{
getOrderInformerEdit(Request.QueryString["singleFlage"].ToString());
}
}
}
///
/// 初始化信息
///
private void getOrderInformerEdit(string Flage)
{
DataTable dt = new DataTable();
DataTable dtItems = new DataTable();
string sql = "select * from T_Sys_ModuleFunctionsOpt where F_Id='" + Flage + "'";
dt = DBUtility.DbHelperSQL.Query(sql).Tables[0];
if (dt.Rows.Count > 0)
{
F_OptCode.Text = dt.Rows[0]["F_OptCode"].ToString();
F_OptName.Text = dt.Rows[0]["F_OptName"].ToString();
F_Remark.Text = dt.Rows[0]["F_Remark"].ToString();
hfID.Value = dt.Rows[0]["F_FunctionId"].ToString();
}
}
///
/// 保存订单信息。
///
///
///
protected void btnSubmit_Click(object sender, EventArgs e)
{
HySoft.BaseCallCenter.Model.T_Sys_ModuleFunctionsOpt orderModel = new Model.T_Sys_ModuleFunctionsOpt();
HySoft.BaseCallCenter.BLL.T_Sys_ModuleFunctionsOpt orderBll = new BLL.T_Sys_ModuleFunctionsOpt();
try
{
if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
{
orderModel.F_FunctionId = Convert.ToInt32(Request.QueryString["id"].ToString());
hfInitList.Value = Request.QueryString["id"].ToString();
}
orderModel.F_OptName = F_OptName.Text.Trim();
orderModel.F_OptCode = F_OptCode.Text.Trim();
orderModel.F_Remark = F_Remark.Text.Trim();
if (Request.QueryString["getPuction"] == "Add")
{
if (orderBll.Add(orderModel) > 0)
{
MessageBoxToWindow("新增成功", "新增提示", "success");
}
else
{
MessageBoxToWindow("新增失败,字典标志不能重复!", "新增提示!", "error");
}
}
if (Request.QueryString["getPuction"] == "Edit")
{
orderModel.F_FunctionId = Convert.ToInt32(hfID.Value);
hfInitList.Value = Request.QueryString["singleFlage"];
orderModel.F_Id = Convert.ToInt32(Request.QueryString["singleFlage"]);
if (orderBll.Update(orderModel))
{
MessageBoxToWindow("修改成功", "修改提示!", "success");
}
else
{
MessageBoxToWindow("修改失败!", "修改提示!", "error");
}
}
}
catch
{
MessageBoxToWindow("失败", "提示!", "error");
}
}
#region 弹出对话框
///
/// 弹出对话框
///
///
///
///
public void MessageBoxToWindow(string title, string content, string type)
{
string script = "";
switch (type)
{
case "error"://失败
type = "error";
script = "";
break;
case "success"://成功
type = "info";
script = "";
break;
case "catch"://异常
type = "warning";
script = "";
break;
default:
type = "question";
break;
}
ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
}
#endregion
}
}