using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HySoft.Common;
namespace HySoft.BaseCallCenter.Web.askmanage
{
public partial class questioncategoryedit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!string.IsNullOrEmpty(Request.QueryString["id"]))
{
InitObj(Request.QueryString["id"].Trim());
}
}
}
void InitObj(string id)
{
try
{
T_Ask_QuestionCategoryObj = new BLL.T_Ask_QuestionCategory().GetModel(Convert.ToInt32(id));
}
catch (Exception ex)
{
}
}
private Model.T_Ask_QuestionCategory T_Ask_QuestionCategoryObj
{
get
{
Model.T_Ask_QuestionCategory model = new Model.T_Ask_QuestionCategory();
if (Request.QueryString["otype"].Trim() == "modify")
{
model.F_CategoryId = Convert.ToInt32(Request.QueryString["id"].Trim());
}
else
{
model.F_CategoryId = 0;
}
//model.F_CategoryNumber = F_CategoryNumber;
model.F_CategoryName = F_CategoryName.Text.Trim();
model.F_CreateOn = DateTime.Now;
try
{
LoginUser p_LoginUser = new LoginUser(this.Context);
model.F_CreateBy = p_LoginUser.UserID;
}
catch { }
model.F_DeleteFlag = 0;
return model;
}
set
{
if (value != null)
{
this.F_CategoryId.Value = value.F_CategoryId.ToString();
F_CategoryName.Text = value.F_CategoryName.Trim();
}
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
if (Request.QueryString["otype"] == "new")
{
if (new BLL.T_Ask_QuestionCategory().Add(T_Ask_QuestionCategoryObj) > 0)
{
MessageBoxToWindow("新增成功", "新增提示", "success");
}
else
{
MessageBoxToWindow("新增失败", "新增提示!", "error");
}
}
if (Request.QueryString["otype"] == "modify")
{
if (new BLL.T_Ask_QuestionCategory().Update(T_Ask_QuestionCategoryObj))
{
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
}
}