public List <OutApplication> GetConfirmHistroy(int accountID, DateTime fromTime, DateTime toTime) { List <OutApplication> iRet = new List <OutApplication>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_OperatorID, SqlDbType.Int).Value = accountID; cmd.Parameters.Add(_From, SqlDbType.DateTime).Value = fromTime; cmd.Parameters.Add(_To, SqlDbType.DateTime).Value = toTime; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOutConfirmHistroy", cmd)) { while (sdr.Read()) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); OutApplication application = 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]), GetOutApplicationItemByOutApplicationID(Convert.ToInt32(sdr[_DbPKID])), sdr[_DbOutLocation].ToString(), OutType.GetOutTypeByID(Convert.ToInt32(sdr[_DbOutType]))); iRet.Add(application); } return(iRet); } }
/// <summary> /// </summary> public List <OutApplication> GetAllOutApplicationByAccountID(int accountID) { List <OutApplication> applicationList = new List <OutApplication>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_AccountID, SqlDbType.Int).Value = accountID; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAllOutApplicationByAccountID", cmd)) { while (sdr.Read()) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); OutApplication application = 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]), GetOutApplicationItemByOutApplicationID(Convert.ToInt32(sdr[_DbPKID])), sdr[_DbOutLocation].ToString(), OutType.GetOutTypeByID(Convert.ToInt32(sdr[_DbOutType]))); applicationList.Add(application); } } return(applicationList); }
/// <summary> /// µÃµ½ËùÓдýÉóºËµÄÇë¼Ùµ¥ /// </summary> /// <returns></returns> public List <OutApplication> GetNeedConfirmOutApplication() { List <OutApplication> iRet = new List <OutApplication>(); SqlCommand cmd = new SqlCommand(); using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetNeedConfirmOutApplication", cmd)) { while (sdr.Read()) { Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); OutApplication application = 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]), GetOutApplicationItemByOutApplicationID(Convert.ToInt32(sdr[_DbPKID])), sdr[_DbOutLocation].ToString(), OutType.GetOutTypeByID(Convert.ToInt32(sdr[_DbOutType]))); application.DiyProcess = RequestUtility.GetDiyProcess(sdr[_DbDiyProcess].ToString()); iRet.Add(application); } return(iRet); } }
/// <summary> /// /// </summary> public OutApplication GetOutApplicationByOutApplicationID(int pKID) { OutApplication application = null; SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_PKID, SqlDbType.Int).Value = pKID; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetOutApplicationByOutApplicationID", cmd)) { while (sdr.Read()) { List <OutApplicationItem> applicationItem = GetOutApplicationItemByOutApplicationID(Convert.ToInt32(sdr[_DbPKID])); Account account = new Account(); account.Id = Convert.ToInt32(sdr[_DbAccountID]); application = new OutApplication(pKID, account, Convert.ToDateTime(sdr[_DbSubmitDate]), sdr[_DbReason].ToString(), Convert.ToDateTime(sdr[_DbFrom]), Convert.ToDateTime(sdr[_DbTo]), Convert.ToDecimal(sdr[_DbCostTime]), applicationItem, sdr[_DbOutLocation].ToString(), OutType.GetOutTypeByID(Convert.ToInt32(sdr[_DbOutType]))); application.DiyProcess = RequestUtility.GetDiyProcess(sdr[_DbDiyProcess].ToString()); break; } } return(application); }
/// <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); } }