本文整理汇总了C#中WMS.CustomClass.QueryBuilder.MakeCustomizeQuery方法的典型用法代码示例。如果您正苦于以下问题:C# QueryBuilder.MakeCustomizeQuery方法的具体用法?C# QueryBuilder.MakeCustomizeQuery怎么用?C# QueryBuilder.MakeCustomizeQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMS.CustomClass.QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder.MakeCustomizeQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
String reportName = Request.QueryString["reportname"];
List<string> list = Session["ReportSession"] as List<string>;
FiltersModel fm = Session["FiltersModel"] as FiltersModel;
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
_dateFrom = list[0];
string _dateTo = list[1];
DateTime DateFrom = Convert.ToDateTime(list[0]);
DateTime DateTo = Convert.ToDateTime(list[1]);
string PathString = "";
string consolidatedMonth = "";
switch (reportName)
{
case "Strength":
List<DailySummary> _BadliList = contex.DailySummaries.Where(aa => aa.Date >= DateFrom && aa.Date <= DateTo).ToList();
List<DailySummary> _TempBadliList = new List<DailySummary>();
title = "Badli Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
else
PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempBadliList, _BadliList),_dateFrom+" TO "+_dateTo);
break;
case "WorkTime":
_BadliList = contex.DailySummaries.Where(aa => aa.Date >= DateFrom && aa.Date <= DateTo).ToList();
_TempBadliList = new List<DailySummary>();
title = "Badli Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/DSWorkSummary.rdlc";
else
PathString = "/WMS/Reports/RDLC/DSWorkSummary.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempBadliList, _BadliList), _dateFrom + " TO " + _dateTo);
break;
case "Consolidated":
_BadliList = contex.DailySummaries.Where(aa => aa.Date >= DateFrom && aa.Date <= DateTo).ToList();
_TempBadliList = new List<DailySummary>();
title = "Badli Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/DSConsolidated.rdlc";
else
PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempBadliList, _BadliList), _dateFrom + " TO " + _dateTo);
break;
}
}
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DivGridSection.Visible = false;
DivGridCrew.Visible = false;
DivGridDept.Visible = false;
DivGridEmp.Visible = false;
DivShiftGrid.Visible = false;
DivLocGrid.Visible = false;
DivTypeGrid.Visible = false;
ReportViewer1.Visible = true;
ReportViewer1.Width = 1050;
ReportViewer1.Height = 700;
DivGridComapny.Visible = false;
SelectedComps.Clear();
SelectedTypes.Clear();
SelectedCrews.Clear();
SelectedDepts.Clear();
SelectedEmps.Clear();
SelectedLocs.Clear();
SelectedSections.Clear();
SelectedShifts.Clear();
LoadGridViews();
RefreshLabels();
DateTime date = DateTime.Today.Date;
if (GlobalVariables.DeploymentType == false)
{
PathString = "/Reports/RDLC/DROverTime.rdlc";
}
else
PathString = "/WMS/Reports/RDLC/DROverTime.rdlc";
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and AttDate = '" + date.Date.Year.ToString() + "-" + date.Date.Month.ToString() + "-" + date.Date.Day.ToString() + "'" + " and ( StatusOT=1 or StatusGZOT = 1 ) ");
List<ViewAttData> _View = dt.ToList<ViewAttData>();
LoadReport(PathString, _View);
}
}
示例3: btnGenerateReport_Click
protected void btnGenerateReport_Click(object sender, EventArgs e)
{
RefreshLabels();
DivGridSection.Visible = false;
DivGridCrew.Visible = false;
DivGridDept.Visible = false;
DivGridEmp.Visible = false;
DivShiftGrid.Visible = false;
DivLocGrid.Visible = false;
DivTypeGrid.Visible = false;
ReportViewer1.Visible = true;
DivGridComapny.Visible = false;
DivGridComapny.Visible = false;
List<ViewAttData> _TempViewList = new List<ViewAttData>();
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
string _dateTo = "'" + DateTo.Date.Year.ToString() + "-" + DateTo.Date.Month.ToString() + "-" + DateTo.Date.Day.ToString() + "'";
string _dateFrom = "'" + DateFrom.Date.Year.ToString() + "-" + DateFrom.Date.Month.ToString() + "-" + DateFrom.Date.Day.ToString() + "'";
DataTable dt = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + _dateFrom + " and AttDate <= " + _dateTo + " )" + " and ( StatusOT=1 " + "or StatusGZOT = 1) ");
List<ViewAttData> _ViewList = dt.ToList<ViewAttData>();
//_ViewList = context.ViewAttDatas.Where(aa => aa.AttDate >= DateFrom.Date && aa.AttDate <= DateTo.Date && (aa.StatusOT == true || aa.StatusGZOT == true)).ToList();
if (SelectedEmps.Count > 0)
{
foreach (var emp in SelectedEmps)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.EmpID == emp.EmpID).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for department
if (SelectedDepts.Count > 0)
{
foreach (var dept in SelectedDepts)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.DeptName == dept.DeptName).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for company
if (SelectedComps.Count > 0)
{
foreach (var comp in SelectedComps)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.CompName == comp.CompName).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for sections
if (SelectedSections.Count > 0)
{
foreach (var sec in SelectedSections)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.SectionName == sec.SectionName).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for crews
if (SelectedCrews.Count > 0)
{
foreach (var cre in SelectedCrews)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.CrewName == cre.CrewName).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for location
if (SelectedLocs.Count > 0)
{
foreach (var loc in SelectedLocs)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.LocName == loc.LocName).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
//.........这里部分代码省略.........
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
String reportName = Request.QueryString["reportname"];
String type = Request.QueryString["type"];
if (!Page.IsPostBack)
{
List<string> list = Session["ReportSession"] as List<string>;
FiltersModel fm = Session["FiltersModel"] as FiltersModel;
CreateDataTable();
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
_dateFrom = list[0];
string _dateTo = list[1];
companyimage = GetCompanyImages(fm);
string PathString = "";
string consolidatedMonth = "";
switch (reportName)
{
case "badli_report":
DataTable badlidt = qb.GetValuesfromDB("select * from ViewBadli where (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'" + _dateTo + "'" + " )");
List<ViewBadli> _BadliList = badlidt.ToList<ViewBadli>();
List<ViewBadli> _TempBadliList = new List<ViewBadli>();
title = "Badli Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/BadliReport.rdlc";
else
PathString = "/WMS/Reports/RDLC/BadliReport.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempBadliList, _BadliList), _dateFrom + " TO " + _dateTo);
break;
//please modify the first case
case "summarized_monthly_report":
List<TASReportDataSet.SummarizedMonthlyReportDataTable> AttDeptdummy = new List<TASReportDataSet.SummarizedMonthlyReportDataTable>().ToList();
title = "Department Attendace Summary";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/SummarizedMonthlyReport.rdlc";
else
PathString = "/WMS/Reports/RDLC/SummarizedMonthlyReport.rdlc";
LoadReport(PathString, AttDeptdummy, _dateFrom + " TO " + _dateTo);
break;
case "Employee_Att_Summary_New_report": DataTable dt4 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and Status=1" + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'" + _dateTo + "'" + " )");
List<ViewAttData> ListOfAttDate = new List<ViewAttData>();
List<ViewAttData> TempList = new List<ViewAttData>();
title = "Employee Attendace Summary New";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/EmpAttSummaryNew.rdlc";
else
PathString = "/WMS/Reports/RDLC/EmpAttSummaryNew.rdlc";
ListOfAttDate = dt4.ToList<ViewAttData>();
TempList = new List<ViewAttData>();
LoadReport(PathString, ReportsFilterImplementation(fm, TempList, ListOfAttDate), _dateFrom + " TO " + _dateTo);
break;
//case "department_attendance_summary": HRReportsMaker hrm = new HRReportsMaker();
// List<AttDeptSummary> AttDept = hrm.GetListForAttDepartmentsSummary(Session["FiltersModel"] as FiltersModel, _dateFrom, _dateTo);
// title = "Department Attendace Summary";
// if (GlobalVariables.DeploymentType == false)
// PathString = "/Reports/RDLC/AttDepartmentSummary.rdlc";
// else
// PathString = "/WMS/Reports/RDLC/AttDepartmentSummary.rdlc";
// LoadReport(PathString, AttDept, _dateFrom + " TO " + _dateTo);
// break;
case "emp_record": DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query + " and Status=1 ");
List<EmpView> _ViewList = dt.ToList<EmpView>();
List<EmpView> _TempViewList = new List<EmpView>();
title = "Employee Record Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/Employee.rdlc";
else
PathString = "/WMS/Reports/RDLC/Employee.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList, _ViewList), _dateFrom + " TO " + _dateTo);
break;
case "emp_record_active": dt = qb.GetValuesfromDB("select * from EmpView " + query+ " and Status=1 ");
_ViewList = dt.ToList<EmpView>();
_TempViewList = new List<EmpView>();
title = "Active Employees Record Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/Employee.rdlc";
else
PathString = "/WMS/Reports/RDLC/Employee.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList, _ViewList), _dateFrom + " TO " + _dateTo);
break;
case "emp_record_inactive": dt = qb.GetValuesfromDB("select * from EmpView " + query + " and Status=0 ");
_ViewList = dt.ToList<EmpView>();
_TempViewList = new List<EmpView>();
title = "Inactive Employees Record Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/Employee.rdlc";
else
PathString = "/WMS/Reports/RDLC/Employee.rdlc";
//.........这里部分代码省略.........
示例5: Index
// GET: /Emp/
public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
{
ViewBag.CurrentSort = sortOrder;
ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
ViewBag.DesigSortParm = sortOrder == "designation" ? "designation_desc" : "designation";
ViewBag.LocSortParm = sortOrder == "location" ? "location_desc" : "location";
ViewBag.SectionSortParm = sortOrder == "section" ? "section_desc" : "section";
ViewBag.DepartmentSortParm = sortOrder == "wing" ? "wing_desc" : "wing";
ViewBag.ShiftSortParm = sortOrder == "shift" ? "shift_desc" : "shift";
ViewBag.TypeSortParm = sortOrder == "type" ? "type_desc" : "type";
//List<EmpView> emps = new List<EmpView>();
if (searchString != null)
{
page = 1;
}
else
{
searchString = currentFilter;
}
User LoggedInUser = Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from EmpView"+query);
List<EmpView> emps = dt.ToList<EmpView>();
ViewBag.CurrentFilter = searchString;
if (!String.IsNullOrEmpty(searchString))
{
if (searchString == "Active" || searchString == "active")
{
emps = emps.Where(aa => aa.Status == true).ToList();
}
else if (searchString == "Inactive" || searchString == "inactive")
{
emps = emps.Where(aa => aa.Status == false).ToList();
}
else
{
try
{
emps = emps.Where(s => s.EmpName.ToUpper().Contains(searchString.ToUpper())
|| s.EmpNo.Contains(searchString.ToUpper())
|| s.SectionName.ToUpper().Contains(searchString.ToUpper())
|| s.ShiftName.ToUpper().Contains(searchString.ToUpper())
|| s.DesignationName.ToUpper().Contains(searchString.ToUpper())).ToList();
}
catch(Exception ex)
{
}
}
}
switch (sortOrder)
{
case "name_desc":
emps = emps.OrderByDescending(s => s.EmpName).ToList();
break;
case "designation_desc":
emps = emps.OrderByDescending(s => s.DesignationName).ToList();
break;
case "designation":
emps = emps.OrderBy(s => s.DesignationName).ToList();
break;
case "location_desc":
emps = emps.OrderByDescending(s => s.LocName).ToList();
break;
case "location":
emps = emps.OrderBy(s => s.LocName).ToList();
break;
case "section_desc":
emps = emps.OrderByDescending(s => s.SectionName).ToList();
break;
case "section":
emps = emps.OrderBy(s => s.SectionName).ToList();
break;
//case "wing_desc":
// emps = emps.OrderByDescending(s => s.sec.DeptName).ToList();
// break;
//case "wing":
// emps = emps.OrderBy(s => s.DeptName).ToList();
// break;
case "shift_desc":
emps = emps.OrderByDescending(s => s.ShiftName).ToList();
break;
case "shift":
emps = emps.OrderBy(s => s.ShiftName).ToList();
break;
case "type_desc":
emps = emps.OrderByDescending(s => s.TypeName).ToList();
break;
case "type":
emps = emps.OrderBy(s => s.TypeName).ToList();
break;
default:
emps = emps.OrderBy(s => s.EmpName).ToList();
break;
}
//.........这里部分代码省略.........
示例6: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DivGridSection.Visible = false;
DivGridCrew.Visible = false;
DivGridDept.Visible = false;
DivGridEmp.Visible = false;
DivShiftGrid.Visible = false;
DivLocGrid.Visible = false;
DivTypeGrid.Visible = false;
ReportViewer1.Visible = true;
ReportViewer1.Width = 1050;
ReportViewer1.Height = 700;
SelectedTypes.Clear();
SelectedCrews.Clear();
SelectedDepts.Clear();
SelectedEmps.Clear();
SelectedLocs.Clear();
SelectedSections.Clear();
SelectedShifts.Clear();
RefreshLabels();
LoadGridViews();
if (GlobalVariables.DeploymentType == false)
{
PathString = "/Reports/RDLC/YLvConsumed.rdlc";
}
else
PathString = "/WMS/Reports/RDLC/YLvConsumed.rdlc";
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from ViewLvConsumed " + query);
List<ViewLvConsumed> _ViewList = dt.ToList<ViewLvConsumed>();
LoadReport(PathString, _ViewList);
}
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DateTime date = DateTime.Today.Date.AddDays(-1);
if (GlobalVariables.DeploymentType == false)
{
PathString = "/Reports/RDLC/DRDetailed.rdlc";
}
else
PathString = "/WMS/Reports/RDLC/DRDetailed.rdlc";
//List<ViewMultipleInOut> _View = new List<ViewMultipleInOut>();
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from ViewMultipleInOut " + query +" and AttDate = '"+ date.Date.Year.ToString()+"-"+date.Date.Month.ToString()+"-"+date.Date.Day.ToString()+"'");
List<ViewMultipleInOut> _View = dt.ToList<ViewMultipleInOut>();
LoadReport(PathString, _View);
}
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DivGridSection.Visible = false;
DivGridCrew.Visible = false;
DivGridDept.Visible = false;
DivGridEmp.Visible = false;
DivShiftGrid.Visible = false;
DivLocGrid.Visible = false;
DivTypeGrid.Visible = false;
ReportViewer1.Visible = true;
ReportViewer1.Width = 1050;
ReportViewer1.Height = 700;
SelectedTypes.Clear();
SelectedCrews.Clear();
SelectedDepts.Clear();
SelectedEmps.Clear();
SelectedLocs.Clear();
SelectedSections.Clear();
SelectedShifts.Clear();
DivGridComapny.Visible = false;
SelectedComps.Clear();
RefreshLabels();
LoadGridViews();
string _period = DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString();
if (GlobalVariables.DeploymentType == false)
{
PathString = "/Reports/RDLC/MRDetailExcelC.rdlc";
}
else
PathString = "/WMS/Reports/RDLC/MRDetailExcelC.rdlc";
List<ViewMonthlyData> _ViewList = new List<ViewMonthlyData>();
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from ViewMonthlyData " + query + " and Period='" + _period+"'");
_ViewList = dt.ToList<ViewMonthlyData>();
LoadReport(PathString, _ViewList);
}
}
示例9: JobCardList
public ActionResult JobCardList(string sortOrder, string searchString, string currentFilter, int? page)
{
ViewBag.CurrentSort = sortOrder;
ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
ViewBag.DesigSortParm = sortOrder == "designation" ? "designation_desc" : "designation";
ViewBag.SectionSortParm = sortOrder == "section" ? "section_desc" : "section";
//List<EmpView> emps = new List<EmpView>();
if (searchString != null)
{
page = 1;
}
else
{
searchString = currentFilter;
}
User LoggedInUser = Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from ViewJobCardApp " + query);
List<ViewJobCardApp> jobCardsApps = dt.ToList<ViewJobCardApp>();
// List<EmpView> emps = db.EmpViews.ToList();
ViewBag.CurrentFilter = searchString;
if (!String.IsNullOrEmpty(searchString))
{
try
{
jobCardsApps = jobCardsApps.Where(s => s.EmpName.ToUpper().Contains(searchString.ToUpper())
|| s.EmpNo.ToUpper().Contains(searchString.ToUpper()) || s.DesignationName.ToString().Contains(searchString)
).OrderByDescending(aa=>aa.DateCreated).ToList();
}
catch (Exception ex)
{
}
}
switch (sortOrder)
{
case "name_desc":
jobCardsApps = jobCardsApps.OrderByDescending(s => s.EmpName).ToList();
break;
case "designation_desc":
jobCardsApps = jobCardsApps.OrderByDescending(s => s.DesignationName).ToList();
break;
case "designation":
jobCardsApps = jobCardsApps.OrderBy(s => s.DesignationName).ToList();
break;
case "section_desc":
jobCardsApps = jobCardsApps.OrderByDescending(s => s.SectionName).ToList();
break;
case "section":
jobCardsApps = jobCardsApps.OrderBy(s => s.SectionName).ToList();
break;
default:
jobCardsApps = jobCardsApps.OrderBy(s => s.EmpName).ToList();
break;
}
int pageSize = 10;
int pageNumber = (page ?? 1);
return View(jobCardsApps.ToPagedList(pageNumber, pageSize));
}
示例10: Index
// GET: /JobCard/
public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
{
ViewBag.CurrentSort = sortOrder;
ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
ViewBag.DesigSortParm = sortOrder == "designation" ? "designation_desc" : "designation";
ViewBag.LocSortParm = sortOrder == "location" ? "location_desc" : "location";
ViewBag.SectionSortParm = sortOrder == "section" ? "section_desc" : "section";
ViewBag.DepartmentSortParm = sortOrder == "wing" ? "wing_desc" : "wing";
ViewBag.ShiftSortParm = sortOrder == "shift" ? "shift_desc" : "shift";
ViewBag.TypeSortParm = sortOrder == "type" ? "type_desc" : "type";
//List<EmpView> emps = new List<EmpView>();
if (searchString != null)
{
page = 1;
}
else
{
searchString = currentFilter;
}
User LoggedInUser = Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query);
List<EmpView> emps = dt.ToList<EmpView>();
// List<EmpView> emps = db.EmpViews.ToList();
ViewBag.CurrentFilter = searchString;
if (!String.IsNullOrEmpty(searchString))
{
if (searchString == "Active" || searchString == "active")
{
emps = emps.Where(aa => aa.Status == true).ToList();
}
else if (searchString == "Inactive" || searchString == "inactive")
{
emps = emps.Where(aa => aa.Status == false).ToList();
}
else
{
try
{
emps = emps.Where(s => s.EmpName.ToUpper().Contains(searchString.ToUpper())
|| s.EmpNo.ToUpper().Contains(searchString.ToUpper()) || s.DesignationName.ToString().Contains(searchString)
).ToList();
}
catch (Exception ex)
{
}
}
}
switch (sortOrder)
{
case "name_desc":
emps = emps.OrderByDescending(s => s.EmpName).ToList();
break;
case "designation_desc":
emps = emps.OrderByDescending(s => s.DesignationName).ToList();
break;
case "designation":
emps = emps.OrderBy(s => s.DesignationName).ToList();
break;
case "location_desc":
emps = emps.OrderByDescending(s => s.LocName).ToList();
break;
case "location":
emps = emps.OrderBy(s => s.LocName).ToList();
break;
case "section_desc":
emps = emps.OrderByDescending(s => s.SectionName).ToList();
break;
case "section":
emps = emps.OrderBy(s => s.SectionName).ToList();
break;
case "wing_desc":
emps = emps.OrderByDescending(s => s.DeptName).ToList();
break;
case "wing":
emps = emps.OrderBy(s => s.DeptName).ToList();
break;
case "shift_desc":
emps = emps.OrderByDescending(s => s.ShiftName).ToList();
break;
case "shift":
emps = emps.OrderBy(s => s.ShiftName).ToList();
break;
case "type_desc":
emps = emps.OrderByDescending(s => s.TypeName).ToList();
break;
case "type":
emps = emps.OrderBy(s => s.TypeName).ToList();
break;
default:
emps = emps.OrderBy(s => s.EmpName).ToList();
break;
}
//.........这里部分代码省略.........
示例11: EditAttJobCard
public ActionResult EditAttJobCard()
{
User LoggedInUser = Session["LoggedUser"] as User;
string Message = "";
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query);
List<EmpView> emps = dt.ToList<EmpView>();
try
{
string _EmpNo = "";
// int CompID = Convert.ToInt16(Request.Form["CompanyID"].ToString());
List<EmpView> _Emp = new List<EmpView>();
short _WorkCardID = Convert.ToInt16(Request.Form["JobCardType"].ToString());
//First Save Job Card Application
JobCardApp jobCardApp = new JobCardApp();
jobCardApp.CardType = _WorkCardID;
jobCardApp.DateCreated = DateTime.Now;
jobCardApp.DateStarted = Convert.ToDateTime(Request.Form["JobDateFrom"]);
jobCardApp.DateEnded = Convert.ToDateTime(Request.Form["JobDateTo"]);
jobCardApp.Status = false;
jobCardApp.UserID = LoggedInUser.UserID;
_EmpNo = Request.Form["JobEmpNo"];
_Emp = emps.Where(aa => aa.EmpNo == _EmpNo).ToList();
if (_Emp.Count > 0)
{
jobCardApp.CriteriaData = _Emp.FirstOrDefault().EmpID;
jobCardApp.JobCardCriteria = "E";
if (ValidateJobCard(jobCardApp))
{
db.JobCardApps.Add(jobCardApp);
if (db.SaveChanges() > 0)
{
AddJobCardAppToJobCardData();
Message = "Job Card Created Sucessfully.";
}
}
else
Message = "Job Card already created for FPID: " + _EmpNo;
}
else
Message = "No Employee found, Please enter a valid FPID";
//Add Job Card to JobCardData and Mark Legends in Attendance Data if attendance Created
Session["EditAttendanceDate"] = DateTime.Today.Date.ToString("yyyy-MM-dd");
ViewData["datef"] = Session["EditAttendanceDate"].ToString();
ViewData["JobDateFrom"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
ViewData["JobDateTo"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
ViewBag.JobCardType = new SelectList(db.JobCards, "WorkCardID", "WorkCardName");
}
catch (Exception ex)
{
Message = "An Error occured while creating Job Card of " + Request.Form["JobCardType"].ToString();
}
//List<EmpView> emps = new List<EmpView>();
ViewData["JobDateFrom"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
ViewData["JobDateTo"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
ViewBag.JobCardType = new SelectList(db.JobCards, "WorkCardID", "WorkCardName");
ViewBag.CMessage = Message;
ViewBag.CurrentFilter = "";
int pageSize = 10;
int? page = 1;
int pageNumber = (page ?? 1);
return View("Index",emps.ToPagedList(pageNumber, pageSize));
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DivGridSection.Visible = false;
DivGridCrew.Visible = false;
DivGridDept.Visible = false;
DivGridEmp.Visible = false;
DivShiftGrid.Visible = false;
DivLocGrid.Visible = false;
DivTypeGrid.Visible = false;
ReportViewer1.Visible = true;
DivGridComapny.Visible = false;
SelectedComps.Clear();
ReportViewer1.Width = 1050;
ReportViewer1.Height = 700;
SelectedTypes.Clear();
SelectedCrews.Clear();
SelectedDepts.Clear();
SelectedEmps.Clear();
SelectedLocs.Clear();
SelectedSections.Clear();
SelectedShifts.Clear();
RefreshLabels();
LoadGridViews();
DateTime date = DateTime.Today.Date.AddDays(-1);
if (GlobalVariables.DeploymentType == false)
{
PathString = "/Reports/RDLC/DRMultipleInOut.rdlc";
}
else
PathString = "/WMS/Reports/RDLC/DRMultipleInOut.rdlc";
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable datatable = qb.GetValuesfromDB("select * from ViewDetailAttData " + query + " and (AttDate = " + "'" + date.ToString("yyyy-MM-dd") + "')" + " and (Tin1 is not null or TOut1 is not null)");
List<ViewDetailAttData> _View = datatable.ToList<ViewDetailAttData>();
LoadReport(PathString, _View);
}
}
示例13: btnGenerateReport_Click
protected void btnGenerateReport_Click(object sender, EventArgs e)
{
RefreshLabels();
DivGridSection.Visible = false;
DivGridCrew.Visible = false;
DivGridDept.Visible = false;
DivGridEmp.Visible = false;
DivShiftGrid.Visible = false;
DivLocGrid.Visible = false;
DivTypeGrid.Visible = false;
ReportViewer1.Visible = true;
DivGridComapny.Visible = false;
List<EmpView> _TempViewList = new List<EmpView>();
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query);
List<EmpView> _ViewList = dt.ToList<EmpView>();
if (SelectedEmps.Count > 0)
{
foreach (var emp in SelectedEmps)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.EmpID == emp.EmpID).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for department
if (SelectedDepts.Count > 0)
{
foreach (var dept in SelectedDepts)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.DeptName == dept.DeptName).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for sections
if (SelectedSections.Count > 0)
{
foreach (var sec in SelectedSections)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.SectionName == sec.SectionName).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for company
if (SelectedComps.Count > 0)
{
foreach (var comp in SelectedComps)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.CompName == comp.CompName).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for crews
if (SelectedCrews.Count > 0)
{
foreach (var cre in SelectedCrews)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.CrewName == cre.CrewName).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for location
if (SelectedLocs.Count > 0)
{
foreach (var loc in SelectedLocs)
{
_TempViewList.AddRange(_ViewList.Where(aa => aa.LocName == loc.LocName).ToList());
}
_ViewList = _TempViewList.ToList();
}
else
_TempViewList = _ViewList.ToList();
_TempViewList.Clear();
//for shifts
if (SelectedShifts.Count > 0)
{
//.........这里部分代码省略.........
示例14: Index
// GET: /LvApp/
public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
{
ViewBag.CurrentSort = sortOrder;
ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
ViewBag.TypeSortParm = sortOrder == "LvType" ? "LvType_desc" : "LvType";
ViewBag.DateSortParm = sortOrder == "Date" ? "Date_desc" : "Date";
if (searchString != null)
{
page = 1;
}
else
{
searchString = currentFilter;
}
User LoggedInUser = Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DateTime dt1 = DateTime.Today;
DateTime dt2 = new DateTime(dt1.Year, 1, 1);
string date = dt2.Year.ToString()+"-"+dt2.Month.ToString()+"-"+dt2.Day.ToString()+" ";
DataTable dt = qb.GetValuesfromDB("select * from ViewLvApplication " + query + " and (ToDate >= '" + date + "')");
List<ViewLvApplication> lvapplications = dt.ToList<ViewLvApplication>();
ViewBag.CurrentFilter = searchString;
//var lvapplications = db.LvApplications.Where(aa=>aa.ToDate>=dt2).Include(l => l.Emp).Include(l => l.LvType1);
if (!String.IsNullOrEmpty(searchString))
{
lvapplications = lvapplications.Where(s => s.EmpName.ToUpper().Contains(searchString.ToUpper())
|| s.EmpNo.ToUpper().Contains(searchString.ToUpper())).ToList();
}
switch (sortOrder)
{
case "name_desc":
lvapplications = lvapplications.OrderByDescending(s => s.EmpName).ToList();
break;
case "LvType_desc":
lvapplications = lvapplications.OrderByDescending(s => s.LvType).ToList();
break;
case "LvType":
lvapplications = lvapplications.OrderBy(s => s.LvType).ToList();
break;
case "Date_desc":
lvapplications = lvapplications.OrderByDescending(s => s.LvDate).ToList();
break;
case "Date":
lvapplications = lvapplications.OrderBy(s => s.LvDate).ToList();
break;
default:
lvapplications = lvapplications.OrderBy(s => s.EmpName).ToList();
break;
}
int pageSize = 8;
int pageNumber = (page ?? 1);
return View(lvapplications.OrderBy(aa=>aa.LvDate).ToPagedList(pageNumber, pageSize));
}
示例15: EditAttJobCard
public ActionResult EditAttJobCard()
{
User LoggedInUser = Session["LoggedUser"] as User;
string Message = "";
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query);
List<EmpView> emps = dt.ToList<EmpView>();
try
{
string _EmpNo = "";
// int CompID = Convert.ToInt16(Request.Form["CompanyID"].ToString());
List<EmpView> _Emp = new List<EmpView>();
short _WorkCardID = Convert.ToInt16(Request.Form["JobCardType"].ToString());
//First Save Job Card Application
JobCardTime jobCardTime = new JobCardTime();
jobCardTime.JobCardID = _WorkCardID;
jobCardTime.CreatedDate = DateTime.Now;
jobCardTime.DutyDate = Convert.ToDateTime(Request.Form["JobDate"]);
string STime = Request.Form["SHour"].ToString();
string ETime = Request.Form["EHour"].ToString();
string STimeH = STime.Substring(0, 2);
string STimeM = STime.Substring(2, 2);
string ETimeH = ETime.Substring(0, 2);
string ETimeM = ETime.Substring(2, 2);
jobCardTime.CreatedBy = LoggedInUser.UserID;
jobCardTime.AssignedBy = Convert.ToInt16(Request.Form["JobCardDesignation"].ToString());
jobCardTime.StartTime = new TimeSpan(Convert.ToInt32(STimeH), Convert.ToInt32(STimeM), 0);
jobCardTime.EndTime = new TimeSpan(Convert.ToInt32(ETimeH), Convert.ToInt32(ETimeM), 0);
jobCardTime.TTime = (jobCardTime.EndTime - jobCardTime.StartTime);
//jobCardTime.StartTime = Convert.toti(Request.Form["SHour"]);
//jobCardTime.EndTime = Convert.ToDateTime(Request.Form["EHour"]);
string Remakrs = Request.Form["Remakrs"].ToString();
if (Remakrs != "")
jobCardTime.Remarks = Remakrs;
jobCardTime.CreatedBy = LoggedInUser.UserID;
_EmpNo = Request.Form["JobEmpNo"];
_Emp = emps.Where(aa => aa.EmpNo == _EmpNo).ToList();
if (_Emp.Count > 0)
{
jobCardTime.EmpID = _Emp.FirstOrDefault().EmpID;
//if ((jobCardTime.EndTime - jobCardTime.StartTime).TotalMinutes > 0)
//{
if (ValidateJobCard(jobCardTime))
{
db.JobCardTimes.Add(jobCardTime);
if (db.SaveChanges() > 0)
{
AddJobCardTimeInAttData(jobCardTime);
Message = "Job Card Created Sucessfully";
}
else
Message = "Job Card is not created due to server error";
}
else
Message = "Job Card already created for FPID: " + _EmpNo;
//}
}
else
Message = "No Employee found, Please enter a valid FPID";
//Add Job Card to JobCardData and Mark Legends in Attendance Data if attendance Created
Session["EditAttendanceDate"] = DateTime.Today.Date.ToString("yyyy-MM-dd");
ViewData["datef"] = Session["EditAttendanceDate"].ToString();
ViewData["JobDate"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
ViewBag.JobCardType = new SelectList(db.JobCards, "WorkCardID", "WorkCardName");
ViewBag.JobCardDesignation = new SelectList(db.Designations, "DesignationID", "DesignationName");
}
catch (Exception ex)
{
Message = "An Error occured while creating Job Card of " + Request.Form["JobCardType"].ToString();
}
//List<EmpView> emps = new List<EmpView>();
ViewData["JobDate"] = DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd");
ViewBag.JobCardType = new SelectList(db.JobCards, "WorkCardID", "WorkCardName");
ViewBag.JobCardDesignation = new SelectList(db.Designations, "DesignationID", "DesignationName");
ViewBag.CMessage = Message;
ViewBag.CurrentFilter = "";
int pageSize = 10;
int? page = 1;
int pageNumber = (page ?? 1);
return View("Index", emps.ToPagedList(pageNumber, pageSize));
}