protected void btnFind_Click(object sender, EventArgs e) { try { condObj = new V_SchedulingSchClass(); if(txtSchName.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.SchName, Convert.ToString(txtSchName.Value)); if(txtLateMinutes.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.LateMinutes, Convert.ToInt32(txtLateMinutes.Value)); if(txtEarlyMinutes.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.EarlyMinutes, Convert.ToInt32(txtEarlyMinutes.Value)); if(txtCheckIn.Value !="" ) condObj.CheckIn = Convert.ToBoolean(txtCheckIn.Checked); if(txtCheckOut.Value !="" ) condObj.CheckOut = Convert.ToBoolean(txtCheckOut.Checked); if(txtColor.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.Color, Convert.ToInt32(txtColor.Value)); if(txtIsOvertime.Value !="" ) condObj.IsOverTime = Convert.ToBoolean(txtIsOvertime.Checked); if(txtYear.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.SchYear, Convert.ToInt32(txtYear.Value)); if(txtMonth.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.SchMonth, Convert.ToInt16(txtMonth.Value)); if(txtDay.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.SchDay, Convert.ToInt16(txtDay.Value)); if(txtType.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.SchType, Convert.ToInt32(txtType.Value)); if(txtSchClassid.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.SchClassid, Convert.ToInt32(txtSchClassid.Value)); if(txtStartHour.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.StartHour, Convert.ToInt32(txtStartHour.Value)); if(txtStartMin.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.StartMin, Convert.ToInt32(txtStartMin.Value)); if(txtEndHour.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.EndHour, Convert.ToInt32(txtEndHour.Value)); if(txtEndMin.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.EndMin, Convert.ToInt32(txtEndMin.Value)); if(txtCheckInHour1.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.CheckInHour1, Convert.ToInt32(txtCheckInHour1.Value)); if(txtCheckInMin1.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.CheckInMin1, Convert.ToInt32(txtCheckInMin1.Value)); if(txtCheckInHour2.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.CheckInHour2, Convert.ToInt32(txtCheckInHour2.Value)); if(txtCheckInMin2.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.CheckInMin2, Convert.ToInt32(txtCheckInMin2.Value)); if(txtCheckOutHour1.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.CheckOutHour1, Convert.ToInt32(txtCheckOutHour1.Value)); if(txtCheckOutMin1.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.CheckOutMin1, Convert.ToInt32(txtCheckOutMin1.Value)); if(txtCheckOutMin2.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.CheckOutMin2, Convert.ToInt32(txtCheckOutMin2.Value)); if(txtCheckOutHour2.Value !="" ) condObj.Like(V_SchedulingSchClass.Attribute.CheckOutHour2, Convert.ToInt32(txtCheckOutHour2.Value)); listObj = BLLTable<V_SchedulingSchClass>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repCus.DataSource = listObj; repCus.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } aspPager.RecordCount = recount; }
private Dictionary<DateTime, List<V_SchedulingSchClass>> GetScheduling(DateTime startTime, DateTime endTime, int type) { Dictionary<DateTime, List<V_SchedulingSchClass>> vsDic = new Dictionary<DateTime, List<V_SchedulingSchClass>>(); Dictionary<DateTime, List<int>> vsidDic = new Dictionary<DateTime, List<int>>(); V_SchedulingSchClass val = new V_SchedulingSchClass(); val.SchYear = 0; val.SchMonth = 0; val.SchDay = 0; val.SchClassid = 0; val.SchType = 0; val.SchName = "";//(50) Unchecked val.StartHour = 0;// Unchecked val.StartMin = 0;// Unchecked val.EndHour = 0;// Unchecked val.EndMin = 0;// Unchecked val.LateMinutes = 0;// Checked val.EarlyMinutes = 0;// Checked val.CheckIn = false;// Checked val.CheckOut = false;// Checked val.CheckInHour1 = 0;// Checked val.CheckInMin1 = 0;// Checked val.CheckInHour2 = 0;// Checked val.CheckInMin2 = 0;// Checked val.CheckOutHour1 = 0;// Checked val.CheckOutMin1 = 0;// Checked val.CheckOutHour2 = 0;// Checked val.CheckOutMin2 = 0;// Checked val.Color = "";//(10) Checked val.IsOverTime = false;// Unchecked val.SchNumber = 0;// Unchecked val.SchUnit = 0;// Unchecked V_SchedulingSchClass con = new V_SchedulingSchClass(); if (type > 0) con.SchType = type; int staffidd = -1; if (staffid.Trim() != "" && int.TryParse(staffid, out staffidd)) con.STAFF_ID = staffidd; else if (deptid.Trim() != "") con.Like(V_SchedulingSchClass.Attribute.DEPT_ID, deptid); else if (orgid.Trim() != "") con.Like(V_SchedulingSchClass.Attribute.ORG_ID, orgid); else con.STAFF_ID = (int)userBase.StaffID; string wher = " CAST(CAST({0} AS char(4)) + '-' + CAST({1} AS char(2)) + '-' + CAST({2} AS char(2)) as datetime) >= '{3}-{4}-{5}' and CAST(CAST({6} AS char(4)) + '-' + CAST({7} AS char(2)) + '-' + CAST({8} AS char(2)) as datetime) <= '{9}-{10}-{11}' "; con.Where(wher, V_SchedulingSchClass.Attribute.SchYear, V_SchedulingSchClass.Attribute.SchMonth, V_SchedulingSchClass.Attribute.SchDay, startTime.Year, startTime.Month, startTime.Day, V_SchedulingSchClass.Attribute.SchYear, V_SchedulingSchClass.Attribute.SchMonth, V_SchedulingSchClass.Attribute.SchDay, endTime.Year, endTime.Month, endTime.Day); val.Distinct = true; con.Distinct = true; con.OrderBy(new List<OrderByItem>(new OrderByItem[] { new OrderByItem(V_SchedulingSchClass.Attribute.StartHour, Order.Asc), new OrderByItem(V_SchedulingSchClass.Attribute.StartMin, Order.Asc), new OrderByItem(V_SchedulingSchClass.Attribute.EndHour, Order.Asc), new OrderByItem(V_SchedulingSchClass.Attribute.EndMin, Order.Asc) })); List<V_SchedulingSchClass> vsList = BLLTable<V_SchedulingSchClass>.Factory(conn).Select(val, con); foreach (V_SchedulingSchClass vs in vsList) { DateTime date = new DateTime(vs.SchYear, vs.SchMonth, vs.SchDay); if (!vsDic.ContainsKey(date)) vsDic.Add(date, new List<V_SchedulingSchClass>()); if (!vsidDic.ContainsKey(date)) vsidDic.Add(date, new List<int>()); if (!vsidDic[date].Contains(vs.SchClassid)) { vsidDic[date].Add(vs.SchClassid); vsDic[date].Add(vs); } } return vsDic; }
protected void btnFind_Click(object sender, EventArgs e) { try { condObj = new V_SchedulingSchClass(); if (txtSchName.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.SchName, Convert.ToString(txtSchName.Value)); } if (txtLateMinutes.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.LateMinutes, Convert.ToInt32(txtLateMinutes.Value)); } if (txtEarlyMinutes.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.EarlyMinutes, Convert.ToInt32(txtEarlyMinutes.Value)); } if (txtCheckIn.Value != "") { condObj.CheckIn = Convert.ToBoolean(txtCheckIn.Checked); } if (txtCheckOut.Value != "") { condObj.CheckOut = Convert.ToBoolean(txtCheckOut.Checked); } if (txtColor.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.Color, Convert.ToInt32(txtColor.Value)); } if (txtIsOvertime.Value != "") { condObj.IsOverTime = Convert.ToBoolean(txtIsOvertime.Checked); } if (txtYear.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.SchYear, Convert.ToInt32(txtYear.Value)); } if (txtMonth.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.SchMonth, Convert.ToInt16(txtMonth.Value)); } if (txtDay.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.SchDay, Convert.ToInt16(txtDay.Value)); } if (txtType.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.SchType, Convert.ToInt32(txtType.Value)); } if (txtSchClassid.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.SchClassid, Convert.ToInt32(txtSchClassid.Value)); } if (txtStartHour.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.StartHour, Convert.ToInt32(txtStartHour.Value)); } if (txtStartMin.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.StartMin, Convert.ToInt32(txtStartMin.Value)); } if (txtEndHour.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.EndHour, Convert.ToInt32(txtEndHour.Value)); } if (txtEndMin.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.EndMin, Convert.ToInt32(txtEndMin.Value)); } if (txtCheckInHour1.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.CheckInHour1, Convert.ToInt32(txtCheckInHour1.Value)); } if (txtCheckInMin1.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.CheckInMin1, Convert.ToInt32(txtCheckInMin1.Value)); } if (txtCheckInHour2.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.CheckInHour2, Convert.ToInt32(txtCheckInHour2.Value)); } if (txtCheckInMin2.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.CheckInMin2, Convert.ToInt32(txtCheckInMin2.Value)); } if (txtCheckOutHour1.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.CheckOutHour1, Convert.ToInt32(txtCheckOutHour1.Value)); } if (txtCheckOutMin1.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.CheckOutMin1, Convert.ToInt32(txtCheckOutMin1.Value)); } if (txtCheckOutMin2.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.CheckOutMin2, Convert.ToInt32(txtCheckOutMin2.Value)); } if (txtCheckOutHour2.Value != "") { condObj.Like(V_SchedulingSchClass.Attribute.CheckOutHour2, Convert.ToInt32(txtCheckOutHour2.Value)); } listObj = BLLTable <V_SchedulingSchClass> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repCus.DataSource = listObj; repCus.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } aspPager.RecordCount = recount; }
private Dictionary <DateTime, List <V_SchedulingSchClass> > GetScheduling(DateTime startTime, DateTime endTime, int type) { Dictionary <DateTime, List <V_SchedulingSchClass> > vsDic = new Dictionary <DateTime, List <V_SchedulingSchClass> >(); Dictionary <DateTime, List <int> > vsidDic = new Dictionary <DateTime, List <int> >(); V_SchedulingSchClass val = new V_SchedulingSchClass(); val.SchYear = 0; val.SchMonth = 0; val.SchDay = 0; val.SchClassid = 0; val.SchType = 0; val.SchName = ""; //(50) Unchecked val.StartHour = 0; // Unchecked val.StartMin = 0; // Unchecked val.EndHour = 0; // Unchecked val.EndMin = 0; // Unchecked val.LateMinutes = 0; // Checked val.EarlyMinutes = 0; // Checked val.CheckIn = false; // Checked val.CheckOut = false; // Checked val.CheckInHour1 = 0; // Checked val.CheckInMin1 = 0; // Checked val.CheckInHour2 = 0; // Checked val.CheckInMin2 = 0; // Checked val.CheckOutHour1 = 0; // Checked val.CheckOutMin1 = 0; // Checked val.CheckOutHour2 = 0; // Checked val.CheckOutMin2 = 0; // Checked val.Color = ""; //(10) Checked val.IsOverTime = false; // Unchecked val.SchNumber = 0; // Unchecked val.SchUnit = 0; // Unchecked V_SchedulingSchClass con = new V_SchedulingSchClass(); if (type > 0) { con.SchType = type; } int staffidd = -1; if (staffid.Trim() != "" && int.TryParse(staffid, out staffidd)) { con.STAFF_ID = staffidd; } else if (deptid.Trim() != "") { con.Like(V_SchedulingSchClass.Attribute.DEPT_ID, deptid); } else if (orgid.Trim() != "") { con.Like(V_SchedulingSchClass.Attribute.ORG_ID, orgid); } else { con.STAFF_ID = (int)userBase.StaffID; } string wher = " CAST(CAST({0} AS char(4)) + '-' + CAST({1} AS char(2)) + '-' + CAST({2} AS char(2)) as datetime) >= '{3}-{4}-{5}' and CAST(CAST({6} AS char(4)) + '-' + CAST({7} AS char(2)) + '-' + CAST({8} AS char(2)) as datetime) <= '{9}-{10}-{11}' "; con.Where(wher, V_SchedulingSchClass.Attribute.SchYear, V_SchedulingSchClass.Attribute.SchMonth, V_SchedulingSchClass.Attribute.SchDay, startTime.Year, startTime.Month, startTime.Day, V_SchedulingSchClass.Attribute.SchYear, V_SchedulingSchClass.Attribute.SchMonth, V_SchedulingSchClass.Attribute.SchDay, endTime.Year, endTime.Month, endTime.Day); val.Distinct = true; con.Distinct = true; con.OrderBy(new List <OrderByItem>(new OrderByItem[] { new OrderByItem(V_SchedulingSchClass.Attribute.StartHour, Order.Asc), new OrderByItem(V_SchedulingSchClass.Attribute.StartMin, Order.Asc), new OrderByItem(V_SchedulingSchClass.Attribute.EndHour, Order.Asc), new OrderByItem(V_SchedulingSchClass.Attribute.EndMin, Order.Asc) })); List <V_SchedulingSchClass> vsList = BLLTable <V_SchedulingSchClass> .Factory(conn).Select(val, con); foreach (V_SchedulingSchClass vs in vsList) { DateTime date = new DateTime(vs.SchYear, vs.SchMonth, vs.SchDay); if (!vsDic.ContainsKey(date)) { vsDic.Add(date, new List <V_SchedulingSchClass>()); } if (!vsidDic.ContainsKey(date)) { vsidDic.Add(date, new List <int>()); } if (!vsidDic[date].Contains(vs.SchClassid)) { vsidDic[date].Add(vs.SchClassid); vsDic[date].Add(vs); } } return(vsDic); }