本文整理汇总了C#中WMS.CustomClass.QueryBuilder.GetValuesfromDB方法的典型用法代码示例。如果您正苦于以下问题:C# QueryBuilder.GetValuesfromDB方法的具体用法?C# QueryBuilder.GetValuesfromDB怎么用?C# QueryBuilder.GetValuesfromDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMS.CustomClass.QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder.GetValuesfromDB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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));
}
示例2: LoadEmpGrid
private void LoadEmpGrid(User _loggedUser)
{
QueryBuilder qb = new QueryBuilder();
string query = qb.MakeCustomizeQuery(_loggedUser);
DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query + " and (Status=1)");
List<EmpView> _View = dt.ToList<EmpView>();
grid_Employee.DataSource = _View;
grid_Employee.DataBind();
}
示例3: BindGridViewDepartment
private void BindGridViewDepartment(string search)
{
FiltersModel fm = Session["FiltersModel"] as FiltersModel;
List<ViewDepartment> _View = new List<ViewDepartment>();
List<ViewDepartment> _TempView = new List<ViewDepartment>();
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
//string query = qb.QueryForCompanyFilters(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from ViewDepartment order by DeptName asc");
_View = dt.ToList<ViewDepartment>();
//if (fm.CompanyFilter.Count > 0)
//{
// foreach (var comp in fm.CompanyFilter)
// {
// short _compID = Convert.ToInt16(comp.ID);
// _TempView.AddRange(_View.Where(aa => aa.CompID == _compID).ToList());
// }
// _View = _TempView.ToList();
//}
if (fm.DivisionFilter.Count > 0)
{
_TempView.Clear();
foreach (var div in fm.DivisionFilter)
{
short _divID = Convert.ToInt16(div.ID);
_TempView.AddRange(_View.Where(aa => aa.DivID == _divID).ToList());
}
_View = _TempView.ToList();
}
GridViewWing.DataSource = _View.Where(aa => aa.DeptName.ToUpper().Contains(search.ToUpper())).ToList();
GridViewWing.DataBind();
}
示例4: 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();
//.........这里部分代码省略.........
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
String reportName = Request.QueryString["reportname"];
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];
string PathString = "";
switch (reportName)
{
case "emp_record": DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query);
List<EmpView> _ViewList = dt.ToList<EmpView>();
List<EmpView> _TempViewList = new List<EmpView>();
title = "Employee 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_detail_excel": DataTable dt1 = qb.GetValuesfromDB("select * from EmpView " + query);
List<EmpView> _ViewList1 = dt1.ToList<EmpView>();
List<EmpView> _TempViewList1 = new List<EmpView>();
title = "Employee Detail Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/EmployeeDetail.rdlc";
else
PathString = "/WMS/Reports/RDLC/EmployeeDetail.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList1, _ViewList1), _dateFrom + " TO " + _dateTo);
break;
case "leave_application": dt1 = qb.GetValuesfromDB("select * from ViewLvApplication " + query + " and (FromDate >= '" + _dateFrom + "' and ToDate <= '" + _dateTo + "' )");
List<ViewLvApplication> _ViewListLvApp = dt1.ToList<ViewLvApplication>();
List<ViewLvApplication> _TempViewListLvApp = new List<ViewLvApplication>();
title = "Leave Application Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/DRLeave.rdlc";
else
PathString = "/WMS/Reports/RDLC/EmployeeDetail.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewListLvApp, _ViewListLvApp), _dateFrom + " TO " + _dateTo);
break;
case "detailed_att": DataTable dt2 = qb.GetValuesfromDB("select * from ViewDetailAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
+ _dateTo + "'" + " )");
List<ViewDetailAttData> _ViewList2 = dt2.ToList<ViewDetailAttData>();
List<ViewDetailAttData> _TempViewList2 = new List<ViewDetailAttData>();
title = "Detailed Attendence";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/DRdetailed.rdlc";
else
PathString = "/WMS/Reports/RDLC/DRdetailed.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList2, _ViewList2), _dateFrom + " TO " + _dateTo);
break;
case "consolidated_att": DataTable dt3 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
+ _dateTo + "'" + " )" );
List<ViewAttData> _ViewList3 = dt3.ToList<ViewAttData>();
List<ViewAttData> _TempViewList3 = new List<ViewAttData>();
title = "Consolidated Attendence";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/DRAttendance.rdlc";
else
PathString = "/WMS/Reports/RDLC/DRAttendance.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList3, _ViewList3), _dateFrom + " TO " + _dateTo);
break;
case "present": DataTable dt4 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
+ _dateTo + "'" + " )" + " and StatusP = 1 ");
List<ViewAttData> _ViewList4 = dt4.ToList<ViewAttData>();
List<ViewAttData> _TempViewList4 = new List<ViewAttData>();
title = "Present Employee Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/DRPresent.rdlc";
else
PathString = "/WMS/Reports/RDLC/DRPresent.rdlc";
LoadReport(PathString, ReportsFilterImplementation(fm, _TempViewList4, _ViewList4), _dateFrom + " TO " + _dateTo);
break;
case "absent": DataTable dt5 = qb.GetValuesfromDB("select * from ViewAttData " + query + " and (AttDate >= " + "'" + _dateFrom + "'" + " and AttDate <= " + "'"
+ _dateTo + "'" + " )" +" and StatusAB = 1 ");
List<ViewAttData> _ViewList5 = dt5.ToList<ViewAttData>();
List<ViewAttData> _TempViewList5 = new List<ViewAttData>();
title = "Absent Employee Report";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/DRAbsent.rdlc";
else
//.........这里部分代码省略.........
示例6: Index
// GET: /LvShort/
public ActionResult Index(string sortOrder, string searchString, string currentFilter, int? page)
{
User LoggedInUser = Session["LoggedUser"] as User;
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;
}
QueryBuilder qb = new QueryBuilder();
string query = qb.QueryForUserAccess(LoggedInUser, qb.CheckForUserRole(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 ViewSLData where " + query);
List<ViewSLData> lvapplications = dt.ToList<ViewSLData>();
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 "Date_desc":
lvapplications = lvapplications.OrderByDescending(s => s.DutyDate).ToList();
break;
case "Date":
lvapplications = lvapplications.OrderBy(s => s.DutyDate).ToList();
break;
default:
lvapplications = lvapplications.OrderBy(s => s.EmpName).ToList();
break;
}
int pageSize = 10;
int pageNumber = (page ?? 1);
return View(lvapplications.OrderByDescending(aa => aa.DutyDate).ToPagedList(pageNumber, pageSize));
}
示例7: 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";
//.........这里部分代码省略.........
示例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;
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);
}
}
示例9: 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));
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
String reportName = Request.QueryString["reportname"];
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 = "where ";
_dateFrom = list[0];
string _dateTo = list[1];
//for only NHA cause its acting crazy. If date is selected 08/01/2014 goed
DateTime dateFrom = Convert.ToDateTime(_dateFrom);
DateTime dateTo = Convert.ToDateTime(_dateTo);
dateFrom = dateFrom.AddDays(0);
dateTo = dateTo.AddDays(0);
_dateFrom = dateFrom.ToString("yyyy-MM-dd");
_dateTo = dateTo.ToString("yyyy-MM-dd");
//end of weird code
string PathString = "";
switch (reportName)
{
case "ServiceLog": DataTable dt = qb.GetValuesfromDB("select * from ViewServiceLog " + query + "(DateTime >= '" + _dateFrom + "' and DateTime <= '" + _dateTo + "' )");
List<ViewServiceLog> _ViewServiceLog = dt.ToList<ViewServiceLog>();
List<ViewServiceLog> _TempViewServiceLog = new List<ViewServiceLog>();
title = "Service Log";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/ServiceLog.rdlc";
else
PathString = "/WMS/Reports/RDLC/ServiceLog.rdlc";
LoadReport(PathString, _ViewServiceLog, _dateFrom + " TO " + _dateTo, title);
break;
#region --Summary--
//case "company_consolidated_summary": DataTable dt = qb.GetValuesfromDB("select * from DailySummary " + query + "(Date >= '" + _dateFrom + "' and Date <= '" + _dateTo + "' )");
// List<DailySummary> _ViewListSum = dt.ToList<DailySummary>();
// List<DailySummary> _TempViewListSum = new List<DailySummary>();
// title = "Company Consolidated Summary";
// if (GlobalVariables.DeploymentType == false)
// PathString = "/Reports/RDLC/DSConsolidated.rdlc";
// else
// PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
// LoadReport(PathString, _ViewListSum, _dateFrom + " TO " + _dateTo, title);
// break;
//case "company_employee_summary": dt = qb.GetValuesfromDB("select * from DailySummary " + query + "(Date >= '" + _dateFrom + "' and Date <= '" + _dateTo + "' )");
// _ViewListSum = dt.ToList<DailySummary>();
// _TempViewListSum = new List<DailySummary>();
// title = "Company Employee Strength";
// if (GlobalVariables.DeploymentType == false)
// PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
// else
// PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
// LoadReport(PathString, _ViewListSum, _dateFrom + " TO " + _dateTo, title);
// break;
//case "company_worktime_summary": dt = qb.GetValuesfromDB("select * from DailySummary " + query + "(Date >= '" + _dateFrom + "' and Date <= '" + _dateTo + "' )");
// _ViewListSum = dt.ToList<DailySummary>();
// _TempViewListSum = new List<DailySummary>();
// title = "Company Worktime Strength";
// if (GlobalVariables.DeploymentType == false)
// PathString = "/Reports/RDLC/DSWorkSummary.rdlc";
// else
// PathString = "/WMS/Reports/RDLC/DSWorkSummary.rdlc";
// LoadReport(PathString, _ViewListSum, _dateFrom + " TO " + _dateTo, title);
// break;
//case "region_consolidated_summary":
// query = getRegionSql();
// string df = "select * from DailySummary where Criteria='R' and " + query + " and (Date >= '" + _dateFrom + "' and Date <= '" + _dateTo + "' )";
// Console.WriteLine(df);
// dt = qb.GetValuesfromDB("select * from DailySummary where Criteria='R' " + query + " and (Date >= '" + _dateFrom + "' and Date <= '" + _dateTo + "' )");
// _ViewListSum = dt.ToList<DailySummary>();
// _TempViewListSum = new List<DailySummary>();
// title = "Region Consolidated Summary";
// if (GlobalVariables.DeploymentType == false)
// PathString = "/Reports/RDLC/DSConsolidated.rdlc";
// else
// PathString = "/WMS/Reports/RDLC/DSConsolidated.rdlc";
// LoadReport(PathString, _ViewListSum, _dateFrom + " TO " + _dateTo, title);
// break;
//case "region_strength_summary":
// query = getRegionSql();
// dt = qb.GetValuesfromDB("select * from DailySummary where Criteria='R' " + query + " and (Date >= '" + _dateFrom + "' and Date <= '" + _dateTo + "' )");
// _ViewListSum = dt.ToList<DailySummary>();
// _TempViewListSum = new List<DailySummary>();
// title = "Region Emoployee Strength Summary";
// if (GlobalVariables.DeploymentType == false)
// PathString = "/Reports/RDLC/DSEmpStrength.rdlc";
// else
// PathString = "/WMS/Reports/RDLC/DSEmpStrength.rdlc";
// LoadReport(PathString, _ViewListSum, _dateFrom + " TO " + _dateTo, title);
// break;
//case "region_worktime_summary":
// query = getRegionSql();
// dt = qb.GetValuesfromDB("select * from DailySummary where Criteria='R' " + query + " and (Date >= '" + _dateFrom + "' and Date <= '" + _dateTo + "' )");
// _ViewListSum = dt.ToList<DailySummary>();
// _TempViewListSum = new List<DailySummary>();
//.........这里部分代码省略.........
示例11: 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)
{
//.........这里部分代码省略.........
示例12: monthlyProductivityProcess
private void monthlyProductivityProcess(String _dateFrom,String _dateTo,String query)
{
QueryBuilder qb = new QueryBuilder();
string PathString = "";
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>();
List<ViewAttData> finalOutput = new List<ViewAttData>();
title = "Employee Attendace Summary New";
if (GlobalVariables.DeploymentType == false)
PathString = "/Reports/RDLC/MonthlyProductivityEmployees.rdlc";
else
PathString = "/WMS/Reports/RDLC/MonthlyProductivityEmployees.rdlc";
ListOfAttDate = dt4.ToList<ViewAttData>();
TempList = new List<ViewAttData>();
finalOutput = ReportsFilterImplementation(fm, TempList, ListOfAttDate);
List<EmpMonthlyProductivityEntity> empe = new List<EmpMonthlyProductivityEntity>();
empe = EmpMonthlyProductivityEntity.ProcessAttendence(finalOutput, _dateFrom, _dateTo);
LoadReport(empe,PathString,_dateFrom,_dateTo);
}
示例13: BindGridViewRegion
private void BindGridViewRegion(string search)
{
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
string query = qb.QueryForRegionInFilters(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from Region "+query+" order by RegionName asc");
List<Region> _View = dt.ToList<Region>();
GridViewRegion.DataSource = _View.Where(aa => aa.RegionName.ToUpper().Contains(search.ToUpper())).ToList();
GridViewRegion.DataBind();
}
示例14: BindGridView
private void BindGridView(string search)
{
User LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
QueryBuilder qb = new QueryBuilder();
//string query = qb.QueryForCompanyView(LoggedInUser);
DataTable dt = qb.GetValuesfromDB("select * from Shift ");
List<Shift> _View = dt.ToList<Shift>();
GridViewShift.DataSource = _View.Where(aa => aa.ShiftName.ToUpper().Contains(search.ToUpper())).ToList();
GridViewShift.DataBind();
}
示例15: 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;
}
//.........这里部分代码省略.........