CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/TestRun/DriverPrepare/SchemePlanItemAdd.aspx.cs

77 lines
3.6 KiB
C#
Raw Normal View History

2024-01-25 15:21:19 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace FineUIPro.Web.TestRun.DriverPrepare
{
public partial class SchemePlanItemAdd : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string SchemePlanItemId = Request.Params["SchemePlanItemId"];
if (!string.IsNullOrEmpty(SchemePlanItemId))
{
Model.DriverPrepare_SchemePlanItem item = DriverPrepareSchemePlanItemService.GetSchemePlanItemById(SchemePlanItemId);
if (item != null)
{
this.txtSolutionName.Text = item.SolutionName;
}
}
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
string SchemePlanItemId = Request.Params["SchemePlanItemId"];
if (!BLL.DriverPrepareSchemePlanItemService.IsExistSolutionName(this.CurrUser.LoginProjectId, this.txtSolutionName.Text.Trim(), SchemePlanItemId))
{
Model.DriverPrepare_SchemePlanItem newItem = new Model.DriverPrepare_SchemePlanItem();
newItem.SolutionName = this.txtSolutionName.Text.Trim();
Model.DriverPrepare_SchemePlan plan = BLL.DriverPrepareSchemePlanService.GetDriverPlanByProjectId(this.CurrUser.LoginProjectId);
int sortIndex = 200;
if (plan != null)
{
var items = BLL.DriverPrepareSchemePlanItemService.GetSchemePlanItemByschemePlanId(plan.SchemePlanId);
sortIndex += items.Count;
newItem.SchemePlanId = plan.SchemePlanId;
}
else
{
Model.DriverPrepare_SchemePlan newData = new Model.DriverPrepare_SchemePlan();
newData.SchemePlanCode = "001";
newData.SchemePlanName = "开车方案编制计划";
newData.CompileMan = this.CurrUser.UserId;
newData.CompileDate = DateTime.Now;
newData.ProjectId = this.CurrUser.LoginProjectId;
newData.SchemePlanId = SQLHelper.GetNewID(typeof(Model.DriverPrepare_SchemePlan));
BLL.DriverPrepareSchemePlanService.AddDriverPrepareDriverPlan(newData);
newItem.SchemePlanId = newData.SchemePlanId;
}
newItem.SortIndex = sortIndex;
if (string.IsNullOrEmpty(SchemePlanItemId))
{
newItem.SchemePlanItemId = SQLHelper.GetNewID();
BLL.DriverPrepareSchemePlanItemService.AddSchemePlanItem(newItem);
BLL.LogService.AddSys_Log(this.CurrUser, newItem.SolutionName, newItem.SolutionName, BLL.Const.ControlItemInitSetMenuId, "增加开车方案!");
}
if (Request.Params["type"] == "modify")
{
newItem.SchemePlanItemId = SchemePlanItemId;
BLL.DriverPrepareSchemePlanItemService.UpdateSchemePlanItem(newItem);
BLL.LogService.AddSys_Log(this.CurrUser, newItem.SolutionName, newItem.SolutionName, BLL.Const.ControlItemInitSetMenuId, "修改开车方案!");
}
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
ShowNotify("此方案已存在!", MessageBoxIcon.Warning);
}
}
}
}