public async Task <HttpResponseMessage> GetBatchByCourseIDForLecturer(int courseID, int LecturerID)
        {
            try
            {
                BatchDAL         dal  = new BatchDAL();
                List <BatchInfo> data = await dal.GetBatchByCourseIDForLecturer(courseID, LecturerID);

                if (data != null)
                {
                    return(Request.CreateResponse <List <BatchInfo> >(HttpStatusCode.OK, data));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound));
                }
            }
            catch (DbEntityValidationException ex)
            {
                var    controllerName = ControllerContext.RouteData.Values["controller"].ToString();
                var    actionName     = ControllerContext.RouteData.Values["action"].ToString();
                Logger log            = new Logger();
                log.ErrorLog(ex, controllerName, actionName);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError));
            }
        }
Beispiel #2
0
        public void TestEmptyGetAllBatches()
        {
            CleanUp();
            List <Batch> batches = BatchDAL.GetAllBatches();

            Assert.AreEqual(null, batches);
        }
Beispiel #3
0
 /// <summary>
 /// Gets all batches.
 /// </summary>
 /// <returns></returns>
 public static List <Batch> GetAllBatches()
 {
     try
     {
         return(BatchDAL.GetAllBatches());
     }
     catch
     {
         throw;
     }
 }
Beispiel #4
0
 /// <summary>
 /// Adds the batch.
 /// </summary>
 /// <param name="batch">The batch.</param>
 /// <returns></returns>
 public static bool AddBatch(Batch batch)
 {
     try
     {
         return(BatchDAL.AddBatch(batch));
     }
     catch
     {
         throw;
     }
 }
Beispiel #5
0
        public void TestGetAllBatches()
        {
            TestAddBatch();

            List <Batch> batches = BatchDAL.GetAllBatches();

            Assert.IsTrue(_batch1.Equals(batches[0]));
            Assert.IsTrue(_batch2.Equals(batches[1]));
            Assert.IsTrue(_batch3.Equals(batches[2]));
            Assert.IsTrue(_batch4.Equals(batches[3]));
            Assert.IsTrue(_batch5.Equals(batches[4]));
            Assert.IsTrue(_batch6.Equals(batches[5]));
        }
Beispiel #6
0
        public void TestAddBatch()
        {
            bool success1, success2, success3, success4, success5, success6;

            success1 = success2 = success3 = success4 = success5 = success6 = false;

            success1 = BatchDAL.AddBatch(_batch1);
            success2 = BatchDAL.AddBatch(_batch2);
            success3 = BatchDAL.AddBatch(_batch3);
            success4 = BatchDAL.AddBatch(_batch4);
            success5 = BatchDAL.AddBatch(_batch5);
            success6 = BatchDAL.AddBatch(_batch6);

            Assert.IsTrue(success1 && success2 && success3 && success4 && success5 && success6);
        }
Beispiel #7
0
        public void CleanUp()
        {
            try
            {
                BatchDAL.DeleteBatch(_batch1);
                BatchDAL.DeleteBatch(_batch2);
                BatchDAL.DeleteBatch(_batch3);
                BatchDAL.DeleteBatch(_batch4);
                BatchDAL.DeleteBatch(_batch5);
                BatchDAL.DeleteBatch(_batch6);
            }
            catch { }

            try
            {
                BatchTypeDAL.DeleteBatchType(type1.Name);
                BatchTypeDAL.DeleteBatchType(type2.Name);
                BatchTypeDAL.DeleteBatchType(type3.Name);
                BatchTypeDAL.DeleteBatchType(type4.Name);
            }
            catch { }
        }
Beispiel #8
0
        public void SetUp()
        {
            type1 = new BatchType("Test1", 12.34, 56.7, 123, null, 65, 142424);
            type2 = new BatchType("Test2", 442.2, 2521.11, 1223, 473, 765, 1212424);
            type3 = new BatchType("Test3", 675.43, 3900.03444, 123, 43, 65, 5787878);
            type4 = new BatchType("Test4", 49.03, 98.48, 123, 43, 65, null);
            BatchTypeDAL.AddBatchType(type1);
            BatchTypeDAL.AddBatchType(type2);
            BatchTypeDAL.AddBatchType(type3);
            BatchTypeDAL.AddBatchType(type4);

            _batch1 = new Batch("Machine1", Convert.ToDateTime("2001-01-01"), type1, true);
            _batch2 = new Batch("Machine2", Convert.ToDateTime("2001-01-01"), type2, true);
            _batch3 = new Batch("Machine3", Convert.ToDateTime("2001-01-01"), type3, true);
            _batch4 = new Batch("Machine4", Convert.ToDateTime("2001-01-01"), type1, true);
            _batch5 = new Batch("Machine5", Convert.ToDateTime("2001-01-01"), type1, true);
            _batch6 = new Batch("Machine6", Convert.ToDateTime("2001-01-01"), type4, false);
            BatchDAL.AddBatch(_batch1);
            BatchDAL.AddBatch(_batch2);
            BatchDAL.AddBatch(_batch3);
            BatchDAL.AddBatch(_batch4);
            BatchDAL.AddBatch(_batch5);
            BatchDAL.AddBatch(_batch6);
        }
Beispiel #9
0
 /// <summary>
 /// To Add Comments
 /// </summary>
 /// <param name="BatchNo"></param>
 /// <param name="PaymentRequestId"></param>
 /// <param name="HHID"></param>
 public void AddBatchComments(BatchBO oBatchBO)
 {
     oBatchDAL = new BatchDAL();
     oBatchDAL.AddBatchComments(oBatchBO);
 }
Beispiel #10
0
 /// <summary>
 /// To CloseBatch details
 /// </summary>
 /// <param name="HHID"></param>
 /// <param name="UserId"></param>
 /// <param name="BatchNo"></param>
 /// <returns></returns>
 public string CloseBatch(int HHID, int UserId, int BatchNo, WorkFlowBO objWorkFlow)
 {
     oBatchDAL = new BatchDAL();
     return(oBatchDAL.CloseBatch(HHID, UserId, BatchNo, objWorkFlow));
 }
Beispiel #11
0
 /// <summary>
 /// To decline batch by ID
 /// </summary>
 /// <param name="BatchNo"></param>
 /// <param name="PaymentRequestId"></param>
 /// <param name="HHID"></param>
 public void DeclineBatchHHID(int BatchNo, int PaymentRequestId, int HHID)
 {
     oBatchDAL = new BatchDAL();
     oBatchDAL.DeclineBatchHHID(BatchNo, PaymentRequestId, HHID);
 }
Beispiel #12
0
 /// <summary>
 /// To Delete Payment Request details from database
 /// </summary>
 /// <param name="PaymentRequestId"></param>
 /// <returns></returns>
 public int DeletePaymentRequest(int PaymentRequestId)
 {
     oBatchDAL = new BatchDAL();
     return(oBatchDAL.DeletePaymentRequest(PaymentRequestId));
 }
Beispiel #13
0
 /// <summary>
 /// To Update Payment Submit details
 /// </summary>
 /// <param name="oBatchBO"></param>
 /// <returns></returns>
 public string UpdatePaymentSubmit(BatchBO oBatchBO)
 {
     oBatchDAL = new BatchDAL();
     return(oBatchDAL.UpdatePaymentRequest(oBatchBO));
 }
Beispiel #14
0
 /// <summary>
 /// To add batch details to database
 /// </summary>
 /// <param name="oBatchBO"></param>
 /// <returns></returns>
 public BatchBO AddBatch(BatchBO oBatchBO)
 {
     oBatchDAL = new BatchDAL();
     return(oBatchDAL.AddBatch(oBatchBO));
 }
Beispiel #15
0
 /// <summary>
 /// To Get Payment Pending Batch details
 /// </summary>
 /// <param name="projectID"></param>
 /// <param name="BatchNo"></param>
 /// <returns></returns>
 public BatchList GetPaymentPendingBatch(int projectID, int BatchNo)
 {
     //FOR PAYMENT REQUEST BATCH
     oBatchDAL = new BatchDAL();
     return(oBatchDAL.GetPaymentPendingBatch(projectID, BatchNo));
 }
Beispiel #16
0
 /// <summary>
 /// To Get Submited Payment details
 /// </summary>
 /// <param name="projectID"></param>
 /// <returns></returns>
 public BatchList GetSubmitedPayment(int projectID)
 {
     oBatchDAL = new BatchDAL();
     return(oBatchDAL.GetSubmitedPayment(projectID));
 }