| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- 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.telmanage
- {
- public partial class worktimessetaddandedit : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- Response.Expires = -1;
- if (!IsPostBack)
- {
- if (!string.IsNullOrEmpty(Request.QueryString["singleFlage"]))
- {
- Initialize(Request.QueryString["singleFlage"]);
- }
- }
- }
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- SaveInfo();
- }
- private void SaveInfo()
- {
- try
- {
- if (!string.IsNullOrWhiteSpace(Request.QueryString["actionFlag"].Trim()))
- {
- string actionFlag = Request.QueryString["actionFlag"].Trim();
- if (actionFlag == "add")
- {
- bool bl = new BLL.T_Sys_WorkTimes().Add(T_Sys_MobileData);
- if (bl)
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
- }
- else
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
- }
- }
- if (actionFlag == "edit")
- {
- bool b2 = new BLL.T_Sys_WorkTimes().Update(T_Sys_MobileData);
- if (b2)
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
- }
- else
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
- }
- }
- }
- }
- catch
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('error')</script>");
- }
- }
- #region 信息初始化
- private void Initialize(string id)
- {
- DateTime dt = new DateTime();
- if (DateTime.TryParse(id, out dt))
- T_Sys_MobileData = new BLL.T_Sys_WorkTimes().GetModel(dt);
- }
- #endregion
- #region 公共属性
- private Model.T_Sys_WorkTimes T_Sys_MobileData
- {
- get
- {
- Model.T_Sys_WorkTimes _model = new Model.T_Sys_WorkTimes();
- if (!string.IsNullOrWhiteSpace(txtMobileNum.Text.Trim()))
- {
- DateTime dt = new DateTime();
- if (DateTime.TryParse(txtMobileNum.Text.Trim(), out dt))
- _model.F_WorkStartTimes = Convert.ToDateTime(dt.ToString("1900-01-01 HH:mm:ss"));
- }
- if (!string.IsNullOrWhiteSpace(txtZipCode.Text.Trim()))
- {
- DateTime dt = new DateTime();
- if (DateTime.TryParse(txtZipCode.Text.Trim(), out dt))
- _model.F_WorkEndTimes = Convert.ToDateTime(dt.ToString("1900-01-01 HH:mm:ss"));
- }
- if (!string.IsNullOrWhiteSpace(txtCityDes.Text.Trim()))
- {
- _model.F_TimeName = txtCityDes.Text.Trim();
- }
- if (!string.IsNullOrWhiteSpace(txtCardDes.Text.Trim()))
- {
- _model.F_Remark = txtCardDes.Text.Trim();
- }
- return _model;
- }
- set
- {
- if (value != null)
- {
- txtMobileNum.Text = value.F_WorkStartTimes.ToString("HH:mm:ss");
- txtZipCode.Text = value.F_WorkEndTimes.ToString("HH:mm:ss");
- txtCityDes.Text = value.F_TimeName;
- txtCardDes.Text = value.F_Remark;
- }
- }
- }
- #endregion
- }
- }
|