Basf_EProject/EProject/FineUIPro.Web/common/Search.aspx.cs

203 lines
8.5 KiB
C#
Raw Normal View History

2024-05-08 11:01:54 +08:00
using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
namespace FineUIPro.Web.common
{
public partial class Search : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BLL.ConstService.InitConstIdDropDownList(this.drpType, Const.ProjectPlanner_JobType, true);
BLL.ConstService.InitConstIdDropDownList(this.drpStatus, Const.ProjectPlanner_JobStatus, true);
BLL.DepartService.InitDepartDropDownList(this.drpDivision, true);
BLL.Sys_UserService.InitUserDropDownList(this.drpProjectManager, true);
BLL.Sys_UserService.InitUserDropDownList(this.drpConstManager, true);
BLL.Sys_UserService.InitUserDropDownList(this.drpOperationRep, true);
//BLL.Sys_UserService.InitUserDropDownList(this.drpLeadBy, true);
BLL.Sys_UserService.InitDropDownList(this.drpLeadBy, true);
BLL.Sys_UserService.InitUserDropDownList(this.drpEngineer, true);
string s = Request.Params["s"];
List<string> lists = Funs.GetStrListByStr(s, '|');
if (!string.IsNullOrEmpty(lists[0]))
{
this.txtJobNo.Text = lists[0];
}
if (!string.IsNullOrEmpty(lists[1]))
{
this.txtJobTitle.Text = lists[1];
}
if (!string.IsNullOrEmpty(lists[2]))
{
var t = BLL.ConstService.GetConstListByTextAndGroupId(lists[2], Const.ProjectPlanner_JobType);
if (t!=null)
{
this.drpType.SelectedValue = t.ConstId;
}
}
if (!string.IsNullOrEmpty(lists[3]))
{
var t = BLL.ConstService.GetConstListByTextAndGroupId(lists[3], Const.ProjectPlanner_JobStatus);
if (t!=null)
{
this.drpStatus.SelectedValue = t.ConstId;
}
}
if (!string.IsNullOrEmpty(lists[4]))
{
var d = BLL.DepartService.GetDepartByName(lists[4]);
if (d!=null)
{
this.drpDivision.SelectedValue = d.DepartId;
}
}
if (!string.IsNullOrEmpty(lists[5]))
{
var u = BLL.Sys_UserService.GetUserByUserName(lists[5]);
if (u!=null)
{
this.drpProjectManager.SelectedValue = u.UserId;
}
}
if (!string.IsNullOrEmpty(lists[6]))
{
var u = BLL.Sys_UserService.GetUserByUserName(lists[6]);
if (u != null)
{
this.drpConstManager.SelectedValue = u.UserId;
}
}
if (!string.IsNullOrEmpty(lists[7]))
{
var u = BLL.Sys_UserService.GetUserByUserName(lists[7]);
if (u != null)
{
this.drpOperationRep.SelectedValue = u.UserId;
}
}
if (!string.IsNullOrEmpty(lists[8]))
{
this.txtAccount.Text = lists[8];
}
if (!string.IsNullOrEmpty(lists[9]))
{
this.txtMOCFormNo.Text = lists[9];
}
if (!string.IsNullOrEmpty(lists[10]))
{
var u = Funs.DB.View_UserDepartDropDownList.FirstOrDefault(x => x.Name == lists[10]);
// BLL.Sys_UserService.GetUserByUserName(lists[10]);
if (u != null)
{
this.drpLeadBy.SelectedValue = u.ID;
}
}
if (!string.IsNullOrEmpty(lists[11]))
{
var u = BLL.Sys_UserService.GetUserByUserName(lists[11]);
if (u!=null)
{
this.drpEngineer.SelectedValue = u.UserId;
}
}
if (!string.IsNullOrEmpty(lists[12]))
{
this.drpCritical.SelectedValue = lists[12];
}
}
}
#region
/// <summary>
/// 确定按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSure_Click(object sender, EventArgs e)
{
string jobNo = this.txtJobNo.Text.Trim();
string jobTitle = this.txtJobTitle.Text.Trim();
string jobType = "";
string jobStatus = "";
string division = "";
string projectManager = "";
string constManager = "";
string operationRep = "";
string leadBy = "";
string engineer = "";
string critical = "";
if (this.drpType.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpType.SelectedValue))
{
jobType = this.drpType.SelectedItem.Text.Trim();
}
if (this.drpStatus.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpStatus.SelectedValue))
{
jobStatus = this.drpStatus.SelectedItem.Text.Trim();
}
if (this.drpDivision.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpDivision.SelectedValue))
{
division = this.drpDivision.SelectedItem.Text.Trim();
}
if (this.drpProjectManager.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpProjectManager.SelectedValue))
{
projectManager = this.drpProjectManager.SelectedItem.Text.Trim();
}
if (this.drpConstManager.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpConstManager.SelectedValue))
{
constManager = this.drpConstManager.SelectedItem.Text.Trim();
}
if (this.drpOperationRep.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpOperationRep.SelectedValue))
{
operationRep = this.drpOperationRep.SelectedItem.Text.Trim();
}
if (this.drpLeadBy.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpLeadBy.SelectedValue))
{
leadBy = this.drpLeadBy.SelectedItem.Text.Trim();
}
if (this.drpEngineer.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpEngineer.SelectedValue))
{
engineer = this.drpEngineer.SelectedItem.Text.Trim();
}
if (drpCritical.SelectedValue != "0")
{
critical = drpCritical.SelectedValue;
}
string result = jobNo + "|" + jobTitle + "|" + jobType + "|" + jobStatus + "|" +
division + "|" + projectManager + "|" + constManager + "|" + operationRep + "|" +
this.txtAccount.Text.Trim() + "|" + this.txtMOCFormNo.Text.Trim() + "|" +
leadBy + "|" + engineer + "|" + critical;
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(result)
+ ActiveWindow.GetHidePostBackReference());
}
#endregion
#region
/// <summary>
/// 重置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnReset_Click(object sender, EventArgs e)
{
this.txtJobNo.Text = string.Empty;
this.txtJobTitle.Text = string.Empty;
this.drpType.SelectedIndex = 0;
this.drpStatus.SelectedIndex = 0;
this.drpDivision.SelectedIndex = 0;
this.drpProjectManager.SelectedIndex = 0;
this.drpConstManager.SelectedIndex = 0;
this.drpOperationRep.SelectedIndex = 0;
this.txtAccount.Text = string.Empty;
this.txtMOCFormNo.Text = string.Empty;
this.drpLeadBy.SelectedIndex = 0;
this.drpEngineer.SelectedIndex = 0;
}
#endregion
}
}