public List <OverWorkItem> GetAllOverWorkForCalendar(int accountID, DateTime from, DateTime to) { List <OverWorkItem> overWorkItemList = new List <OverWorkItem>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = accountID; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = from; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = to; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAllOverWorkForCalendar", cmd)) { while (sdr.Read()) { OverWorkItem overworkItem = new OverWorkItem(Convert.ToInt32(sdr[_DbTOverWorkItemPKID]), Convert.ToDateTime(sdr[_DbTOverWorkItemFrom]), Convert.ToDateTime(sdr[_DbTOverWorkItemTo]), Convert.ToDecimal(sdr[_DbTOverWorkItemCostTime]), RequestStatus.FindRequestStatus(Convert.ToInt32(sdr[_DbTOverWorkItemStatus])), (OverWorkType)sdr[_DbTOverWorkItemOverWorkType], OverWorkItem.IntToAdjust(Convert.ToInt32(sdr[_DbTOverWorkItemAdjust])), Convert.ToDecimal(sdr[_DbTOverWorkItemAdjustHour])); overworkItem.OverWorkID = Convert.ToInt32(sdr[_DbTOverWorkItemOverWorkID]); overWorkItemList.Add(overworkItem); } return(overWorkItemList); } }
/// <summary> /// /// </summary> public List <OutApplication> GetOutApplicationByAccountAndRelatedDate(int accountID, DateTime from, DateTime to) { List <OutApplication> outApplicationList = new List <OutApplication>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = accountID; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = from; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = to; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAllOutApplicationForCalendar", cmd)) { while (sdr.Read()) { OutApplication outApplication = OutApplication.FindOverWorkByPKID(outApplicationList, Convert.ToInt32(sdr[_DbPKID])); if (outApplication == null) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); outApplication = new OutApplication(Convert.ToInt32(sdr[_DbPKID]), account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), new List <OutApplicationItem>(), sdr[_DbOutLocation].ToString(), OutType.GetOutTypeByID(Convert.ToInt32(sdr[_DbOutType]))); outApplicationList.Add(outApplication); } OutApplicationItem applicationItem = new OutApplicationItem(Convert.ToInt32(sdr[_DbTOutApplicationItemPKID]), Convert.ToDateTime(sdr[_DbTOutApplicationItemFrom]), Convert.ToDateTime(sdr[_DbTOutApplicationItemTo]), Convert.ToDecimal(sdr[_DbTOutApplicationItemCostTime]), RequestStatus.FindRequestStatus( Convert.ToInt32(sdr[_DbTOutApplicationItemStatus])), OverWorkItem.IntToAdjust(Convert.ToInt32(sdr[_DbTOutApplicationItemAdjust])), Convert.ToDecimal(sdr[_DbTOutApplicationItemAdjustHour])); applicationItem.OutApplicationID = Convert.ToInt32(sdr[_DbTOutApplicationItemOutApplicationID]); outApplication.Item.Add(applicationItem); } return(outApplicationList); } }
public List <OverWork> GetOverWorkByAccountAndRelatedDate(int accountID, DateTime from, DateTime to) { List <OverWork> overWorkList = new List <OverWork>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = accountID; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = from; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = to; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAllOverWorkForCalendar", cmd)) { while (sdr.Read()) { OverWork overwork = OverWork.FindOverWorkByPKID(overWorkList, Convert.ToInt32(sdr[_DbPKID])); if (overwork == null) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); overwork = new OverWork(Convert.ToInt32(sdr[_DbPKID]), account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), new List <OverWorkItem>(), sdr[_DbProjectName].ToString()); overWorkList.Add(overwork); } OverWorkItem overworkItem = new OverWorkItem(Convert.ToInt32(sdr[_DbTOverWorkItemPKID]), Convert.ToDateTime(sdr[_DbTOverWorkItemFrom]), Convert.ToDateTime(sdr[_DbTOverWorkItemTo]), Convert.ToDecimal(sdr[_DbTOverWorkItemCostTime]), RequestStatus.FindRequestStatus(Convert.ToInt32(sdr[_DbTOverWorkItemStatus])), (OverWorkType)sdr[_DbTOverWorkItemOverWorkType], OverWorkItem.IntToAdjust(Convert.ToInt32(sdr[_DbTOverWorkItemAdjust])), Convert.ToDecimal(sdr[_DbTOverWorkItemAdjustHour])); overworkItem.OverWorkID = Convert.ToInt32(sdr[_DbTOverWorkItemOverWorkID]); overwork.Item.Add(overworkItem); } return(overWorkList); } }
/// <summary> /// </summary> public OverWorkItem GetOverWorkItemByItemID(int itemID) { OverWorkItem overworkItem = null; SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_PKID, SqlDbType.Int).Value = itemID; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOverWorkItemByItemID", cmd)) { while (sdr.Read()) { overworkItem = new OverWorkItem(Convert.ToInt32(sdr[_DbPKID]), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), RequestStatus.FindRequestStatus(Convert.ToInt32(sdr[_DbStatus])), (OverWorkType)sdr[_DbOverWorkType], OverWorkItem.IntToAdjust(Convert.ToInt32(sdr[_DbAdjust])), Convert.ToDecimal(sdr[_DbAdjustHour])); overworkItem.OverWorkID = Convert.ToInt32(sdr[_DbOverWorkID]); overworkItem.OverWorkFlow = GetOverWorkFlowByItemID(Convert.ToInt32(sdr[_DbPKID])); } } return(overworkItem); }
/// <summary> /// </summary> public List <OverWorkItem> GetOverWorkItemByOverWorkID(int overWorkID) { List <OverWorkItem> applicationList = new List <OverWorkItem>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_OverWorkID, SqlDbType.Int).Value = overWorkID; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOverWorkItemByOverWorkID", cmd)) { while (sdr.Read()) { OverWorkItem applicationItem = new OverWorkItem(Convert.ToInt32(sdr[_DbPKID]), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), RequestStatus.FindRequestStatus(Convert.ToInt32(sdr[_DbStatus])), (OverWorkType)sdr[_DbOverWorkType], OverWorkItem.IntToAdjust(Convert.ToInt32(sdr[_DbAdjust])), Convert.ToDecimal(sdr[_DbAdjustHour])); applicationItem.OverWorkFlow = GetOverWorkFlowByItemID(Convert.ToInt32(sdr[_DbPKID])); applicationList.Add(applicationItem); } } return(applicationList); }
/// <summary> /// /// </summary> public List <OutApplicationItem> GetOutApplicationForCalendar(int accountID, DateTime from, DateTime to) { List <OutApplicationItem> outApplicationItemList = new List <OutApplicationItem>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = accountID; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = from; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = to; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOutApplicationForCalendar", cmd)) { while (sdr.Read()) { OutApplicationItem applicationItem = new OutApplicationItem(Convert.ToInt32(sdr[_DbPKID]), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), RequestStatus.FindRequestStatus(Convert.ToInt32(sdr[_DbStatus])), OverWorkItem.IntToAdjust(Convert.ToInt32(sdr[_DbAdjust])), Convert.ToDecimal(sdr[_DbAdjustHour])); outApplicationItemList.Add(applicationItem); } return(outApplicationItemList); } }