CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/PZHGL/GJSX/GJSXDetailEdit.aspx.cs

158 lines
4.5 KiB
C#

using BLL;
using Model;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.PZHGL.GJSX
{
public partial class GJSXDetailEdit : PageBase
{
#region
/// <summary>
/// 事项Id
/// </summary>
private string GJSXID
{
get
{
return (string)ViewState["GJSXID"];
}
set
{
ViewState["GJSXID"] = value;
}
}
/// <summary>
/// 事项进展Id
/// </summary>
private string GJSXDetailId
{
get
{
return (string)ViewState["GJSXDetailId"];
}
set
{
ViewState["GJSXDetailId"] = value;
}
}
/// <summary>
/// 项目主键
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.GJSXID = Request.Params["GJSXID"];
this.ProjectId = this.CurrUser.LoginProjectId;
}
}
#region
/// <summary>
/// 上传附件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttachUrl_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(this.txtProgress_detail.Text.Trim()))
{
Alert.ShowInParent("请输入进展情况!", MessageBoxIcon.Warning);
return;
}
SaveData();
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/Gjsx&menuId={1}",
this.GJSXDetailId, BLL.Const.GJSXMenuId)));
}
#endregion
/// <summary>
/// 保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData();
ShowNotify("保存成功", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
/// <summary>
/// 保存事项进展数据
/// </summary>
protected void SaveData()
{
var progressStatus = this.ddlProgressStatus.SelectedValue;
Model.SGGLDB db = Funs.DB;
var model = new Model.GJSX_detail
{
GJSXID = this.GJSXID,
//Cuid = this.GJSXDetailId,
Progress_detail = this.txtProgress_detail.Text.Trim(),
ProgressStatus = progressStatus,
Progress_user = this.CurrUser.UserId,
Date = DateTime.Now,
//Sort = sortIndex
};
if (!string.IsNullOrEmpty(this.GJSXDetailId))
{
model.Cuid = this.GJSXDetailId;
}
else
{
this.GJSXDetailId = SQLHelper.GetNewID(typeof(Model.GJSX_detail));
//var lastGJSX = db.GJSX_detail.Where(p => p.GJSXID == this.GJSXID).OrderByDescending(x => x.Sort).FirstOrDefault();
//int sortIndex = lastGJSX != null ? (int)lastGJSX.Sort + 1 : 0;
//model.Sort = sortIndex;
model.Cuid = this.GJSXDetailId;
db.GJSX_detail.InsertOnSubmit(model);
}
var gjsx = db.GJSX.Where(p => p.GJSXID == this.GJSXID).FirstOrDefault();
if (progressStatus == "申请关闭")
{//申请关闭
gjsx.State = "3";
gjsx.ProgressStatus = "1";
}
else if (progressStatus == "持续跟踪")
{//持续跟踪
gjsx.ProgressStatus = "0";
}
db.SubmitChanges();
//ShowNotify("保存成功", MessageBoxIcon.Success);
//PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
}
}