public JsonResponse CreateQuarter(GoalQuarters QuarterDetail)
 {
     JsonResponse js = new JsonResponse();
     try
     {
         var Cq = CheckQuarter(QuarterDetail.GoalQuarter, QuarterDetail.QuarterYear);
         if (Cq != null)
         {
             var qurter = _repository.CreateQuarterDB(QuarterDetail);
             if (qurter)
             {
                 js.message = "Quarter created successfully!";
                 js.success = true;
                 return js;
             }
             else
             {
                 js.message = "Error while creating quarter!";
                 js.success = false;
                 return js;
             }
         }
         else
         {
             js.message = "Quarter Is already Added!";
             js.success = false;
             return js;
         }
     }
     catch
     {
         this.ValidationErrors.Add("ERR_DEL_QUA", "Error Occured while Creating Quarter!");
         return null;
     }
 }
예제 #2
0
 public void AddQuarterTest()
 {
     GoalQuarters Quarter = new GoalQuarters();
     Quarter.GoalQuarter = 4;
     Quarter.QuarterYear = 2010;
     Quarter.GoalCreateFrom = DateTime.Today.AddYears(-5);
     Quarter.GoalCreateTo = DateTime.Today.AddYears(-5);
     JsonResponse obj = _quarterService.CreateQuarter(Quarter);
     Assert.AreEqual(true, obj.success);
 }
 public JsonResult AddQuarter(GoalQuarters QuarterData)
 {
     try
     {
         var IsCreate = _quarterService.CreateQuarter(QuarterData);
         return Json(new JsonResponse { message = IsCreate.message, success = IsCreate.success }); ;
     }
     catch
     {
         return Json(new JsonResponse { message = "Error occured while creating Quarter!", success = false });
     }
 }