提交代码
This commit is contained in:
@@ -0,0 +1,278 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.CQMS.Performance
|
||||
{
|
||||
public partial class TaskContentEdit : PageBase
|
||||
{
|
||||
//主键
|
||||
public string PerformanceGid
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["PerformanceGid"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["PerformanceGid"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string CreateDateMonth
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["CreateDateMonth"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["CreateDateMonth"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region CustomClass
|
||||
|
||||
public class CustomClass
|
||||
{
|
||||
private string _id;
|
||||
|
||||
public string ID
|
||||
{
|
||||
get { return _id; }
|
||||
set { _id = value; }
|
||||
}
|
||||
private string _name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
public CustomClass(string id, string name)
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 页面加载
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
//主键
|
||||
PerformanceGid = Request.Params["PerformanceGid"];
|
||||
CreateDateMonth = Request.Params["CreateDateMonth"];
|
||||
//根据主键获取周
|
||||
var CreateDateWeek = db.CQMS_Performance.FirstOrDefault(x => x.PerformanceGid == PerformanceGid).CreateDateMonth;
|
||||
|
||||
var datesConfig = Convert.ToDateTime(CreateDateMonth);
|
||||
var Month = 1;
|
||||
if (datesConfig.Month != 12)
|
||||
{
|
||||
Month = datesConfig.Month + 1;
|
||||
}
|
||||
//按照日期查询是否有设置
|
||||
var modelConfig = Funs.DB.CQMS_Performance_SetUp.FirstOrDefault(x => x.CreateYear == datesConfig.Year.ToString() && x.SortIndex == Month);
|
||||
List<CustomClass> myList = new List<CustomClass>();
|
||||
myList.Add(new CustomClass("1", "第一周"));
|
||||
myList.Add(new CustomClass("2", "第二周"));
|
||||
myList.Add(new CustomClass("3", "第三周"));
|
||||
myList.Add(new CustomClass("4", "第四周"));
|
||||
if (modelConfig.SetUpWeek == 5)
|
||||
{
|
||||
myList.Add(new CustomClass("5", "第五周"));
|
||||
}
|
||||
ddlNowWeek.DataTextField = "Name";
|
||||
ddlNowWeek.DataValueField = "ID";
|
||||
ddlNowWeek.DataSource = myList;
|
||||
ddlNowWeek.DataBind();
|
||||
|
||||
//加载数据
|
||||
BindText();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据周加载数据
|
||||
/// </summary>
|
||||
private void BindText() {
|
||||
//默认加载第一周的各项数据,倒序
|
||||
var child2List = Funs.DB.CQMS_Performance_Child2.Where(x => x.PerformanceGid == PerformanceGid && x.NowWeek == Convert.ToInt32(ddlNowWeek.SelectedValue)).OrderByDescending(x => x.SortIndex).ToList();
|
||||
if (child2List.Count > 0)
|
||||
{
|
||||
txtTaskContentJf.Text = child2List[0].TaskContent;
|
||||
txtTaskContentGjsx.Text = child2List[1].TaskContent;
|
||||
txtTaskContentTz.Text = child2List[2].TaskContent;
|
||||
txtTaskContentZl.Text = child2List[3].TaskContent;
|
||||
txtTaskContentHse.Text = child2List[4].TaskContent;
|
||||
|
||||
//如果数量是6 就按顺序来,7 8 则是多2条数据
|
||||
if (child2List.Count == 6)
|
||||
{
|
||||
txtTaskContent1.Text = child2List[5].TaskContent;
|
||||
txtProjectQuantity1.Text = child2List[5].ProjectQuantity;
|
||||
txtDemandPlan1.Text = child2List[5].DemandPlan;
|
||||
fr1.Hidden = true;
|
||||
fr2.Hidden = true;
|
||||
}
|
||||
else if (child2List.Count == 7)
|
||||
{
|
||||
txtTaskContent2.Text = child2List[5].TaskContent;
|
||||
txtProjectQuantity2.Text = child2List[5].ProjectQuantity;
|
||||
txtDemandPlan2.Text = child2List[5].DemandPlan;
|
||||
|
||||
txtTaskContent1.Text = child2List[6].TaskContent;
|
||||
txtProjectQuantity1.Text = child2List[6].ProjectQuantity;
|
||||
txtDemandPlan1.Text = child2List[6].DemandPlan;
|
||||
fr2.Hidden = true;
|
||||
}
|
||||
else if (child2List.Count == 8)
|
||||
{
|
||||
|
||||
txtTaskContent3.Text = child2List[5].TaskContent;
|
||||
txtProjectQuantity3.Text = child2List[5].ProjectQuantity;
|
||||
txtDemandPlan3.Text = child2List[5].DemandPlan;
|
||||
|
||||
txtTaskContent2.Text = child2List[6].TaskContent;
|
||||
txtProjectQuantity2.Text = child2List[6].ProjectQuantity;
|
||||
txtDemandPlan2.Text = child2List[6].DemandPlan;
|
||||
|
||||
txtTaskContent1.Text = child2List[7].TaskContent;
|
||||
txtProjectQuantity1.Text = child2List[7].ProjectQuantity;
|
||||
txtDemandPlan1.Text = child2List[7].DemandPlan;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("未查询到月节点目标数据,请重新生成。", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据周更改数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void OnddlNowWeekChanged(object sender, EventArgs e) {
|
||||
BindText();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnEdit_Click(object sender, EventArgs e) {
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
//依次修改各周任务安排
|
||||
#region 参数
|
||||
var TaskContent1 = txtTaskContent1.Text.Trim();
|
||||
var ProjectQuantity1 = txtProjectQuantity1.Text.Trim();
|
||||
var DemandPlan1 = txtDemandPlan1.Text.Trim();
|
||||
|
||||
var TaskContent2 = txtTaskContent2.Text.Trim();
|
||||
var ProjectQuantity2 = txtProjectQuantity2.Text.Trim();
|
||||
var DemandPlan2 = txtDemandPlan2.Text.Trim();
|
||||
|
||||
var TaskContent3 = txtTaskContent3.Text.Trim();
|
||||
var ProjectQuantity3 = txtProjectQuantity3.Text.Trim();
|
||||
var DemandPlan3 = txtDemandPlan3.Text.Trim();
|
||||
|
||||
var TaskContentHse = txtTaskContentHse.Text.Trim();
|
||||
|
||||
var TaskContentZl = txtTaskContentZl.Text.Trim();
|
||||
|
||||
var TaskContentTz = txtTaskContentTz.Text.Trim();
|
||||
|
||||
var TaskContentGjsx = txtTaskContentGjsx.Text.Trim();
|
||||
|
||||
var TaskContentJf = txtTaskContentJf.Text.Trim();
|
||||
#endregion
|
||||
|
||||
var child2List = db.CQMS_Performance_Child2.Where(x => x.NowWeek == Convert.ToInt32(ddlNowWeek.SelectedValue) && x.PerformanceGid == PerformanceGid).
|
||||
OrderByDescending(x => x.SortIndex).ToList();
|
||||
|
||||
var child2Model = child2List[0];
|
||||
child2Model.TaskContent = TaskContentJf;
|
||||
db.SubmitChanges();
|
||||
|
||||
child2Model= child2List[1];
|
||||
child2Model.TaskContent = TaskContentGjsx;
|
||||
db.SubmitChanges();
|
||||
|
||||
child2Model = child2List[2];
|
||||
child2Model.TaskContent = TaskContentTz;
|
||||
db.SubmitChanges();
|
||||
|
||||
child2Model = child2List[3];
|
||||
child2Model.TaskContent = TaskContentZl;
|
||||
db.SubmitChanges();
|
||||
|
||||
child2Model = child2List[4];
|
||||
child2Model.TaskContent = TaskContentHse;
|
||||
db.SubmitChanges();
|
||||
|
||||
if (child2List.Count == 8)
|
||||
{
|
||||
child2Model = child2List[5];
|
||||
child2Model.TaskContent = TaskContent3;
|
||||
child2Model.ProjectQuantity = ProjectQuantity3;
|
||||
child2Model.DemandPlan = DemandPlan3;
|
||||
db.SubmitChanges();
|
||||
|
||||
child2Model = child2List[6];
|
||||
child2Model.TaskContent = TaskContent2;
|
||||
child2Model.ProjectQuantity = ProjectQuantity2;
|
||||
child2Model.DemandPlan = DemandPlan2;
|
||||
db.SubmitChanges();
|
||||
|
||||
child2Model = child2List[7];
|
||||
child2Model.TaskContent = TaskContent1;
|
||||
child2Model.ProjectQuantity = ProjectQuantity1;
|
||||
child2Model.DemandPlan = DemandPlan1;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
else if (child2List.Count==7)
|
||||
{
|
||||
child2Model = child2List[5];
|
||||
child2Model.TaskContent = TaskContent2;
|
||||
child2Model.ProjectQuantity = ProjectQuantity2;
|
||||
child2Model.DemandPlan = DemandPlan2;
|
||||
db.SubmitChanges();
|
||||
|
||||
child2Model = child2List[6];
|
||||
child2Model.TaskContent = TaskContent1;
|
||||
child2Model.ProjectQuantity = ProjectQuantity1;
|
||||
child2Model.DemandPlan = DemandPlan1;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
else if (child2List.Count==6)
|
||||
{
|
||||
child2Model = child2List[5];
|
||||
child2Model.TaskContent = TaskContent1;
|
||||
child2Model.ProjectQuantity = ProjectQuantity1;
|
||||
child2Model.DemandPlan = DemandPlan1;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
ShowNotify("修改成功。", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user