initProject
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.ManHours
|
||||
{
|
||||
public partial class SelectPlan : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
string UserId = Request.Params["UserId"];
|
||||
|
||||
//var manHours = from x in Funs.DB.ManHours_Plan
|
||||
// where x.EngineerId == UserId && x.AccountDisabled == 0
|
||||
// group x by x.EProjectId;
|
||||
|
||||
//foreach (var m in manHours)
|
||||
//{
|
||||
// string eprojectId = m.Key;
|
||||
// var rp = BLL.ResourcePlanService.GetResourcePlanByEProjectId(eprojectId);
|
||||
// var eproj = BLL.EProjectService.GeteProjectById(eprojectId);
|
||||
// // 当network的值大于30天时第一个资源的人工时关闭
|
||||
// if (rp.Count() > 1 && eproj.ProjectControl_NetworkDate.HasValue)
|
||||
// {
|
||||
// if (eproj.ProjectControl_NetworkDate.Value.AddDays(30) < DateTime.Now.Date)
|
||||
// {
|
||||
// var r = rp.Where(x => x.WO != eproj.ProjectControl_NetworkNo);
|
||||
// if (r != null)
|
||||
// {
|
||||
// Model.ManHours_Plan man = Funs.DB.ManHours_Plan.FirstOrDefault(x => x.ResourcePlanId == r.First().ResourcePlanId);
|
||||
// man.AccountDisabled = 1;
|
||||
// Funs.DB.SubmitChanges();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
BindGrid(UserId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sId"></param>
|
||||
private void BindGrid(string UserId)
|
||||
{
|
||||
string strSql = @"SELECT * from View_NewManHours_Plan
|
||||
WHERE AccountDisabled=0 and IsCalculated=1
|
||||
AND (ProjectControl_JobStatus='Detail Design' OR ProjectControl_JobStatus='In Construction' OR ProjectControl_JobStatus='In Procurement'
|
||||
OR ProjectControl_JobStatus='Study' OR ProjectControl_JobStatus='Not Start' OR ProjectControl_JobStatus='On Going'
|
||||
OR (ProjectControl_JobStatus='Cancelled' and datediff(MONTH,ProjectControl_PC_CancelDate,GETDATE())<=3)
|
||||
OR (ProjectControl_JobStatus='MC' and datediff(MONTH,CM_MA_MC,GETDATE())<=4))";
|
||||
// 暂不加
|
||||
// OR (AccountDisabled=1 AND (ProjectControl_JobType='Projects' OR ProjectControl_JobType='Small Invest')
|
||||
// AND(ProjectControl_NetworkDate IS NOT NULL AND DATEDIFF(DAY, ProjectControl_NetworkDate, GETDATE()) <= 30))
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
if (!string.IsNullOrEmpty(UserId))
|
||||
{
|
||||
strSql += " AND EngineerId=@EngineerId ";
|
||||
listStr.Add(new SqlParameter("@EngineerId", UserId));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
|
||||
{
|
||||
strSql += " AND ProjectControl_JobNo like @jobno ";
|
||||
listStr.Add(new SqlParameter("@jobno", "%" + this.txtJobNo.Text.Trim() + "%"));
|
||||
}
|
||||
strSql += " ORDER BY ProjectControl_JobNo DESC ";
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable table = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
protected void drpJobNo_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid(Request.Params["UserId"].ToString());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提交按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string itemsString = "";
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
//ResourcePlanId,EProjectId,EngineerId,DisciplineId
|
||||
//string rowID = Grid1.DataKeys[rowIndex][0].ToString() + "|" + Grid1.DataKeys[rowIndex][1].ToString() + "|" + Grid1.DataKeys[rowIndex][2].ToString();
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
if (!itemsString.Contains(rowID))
|
||||
{
|
||||
itemsString += rowID + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
itemsString = itemsString.Substring(0, itemsString.LastIndexOf(","));
|
||||
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(itemsString)
|
||||
+ ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user