Esempio n. 1
0
 /// <summary>
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Tra_ClassModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Tra_ClassModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetByIdUseStore<Tra_ClassEntity>(id, ConstantSql.hrm_tra_sp_get_ClassById, ref status);
     if (entity!=null)
     {
         if (entity.TrainerOtherList != null)
             entity.TrainerOtherList = entity.TrainerOtherList.Replace(" ", "");
         model = entity.CopyData<Tra_ClassModel>();
         if(model.IsTrainingOut == false)
         {
             model.IsTrainingInside = true;
         }
             if (entity.Teacher != null)
             {
                 //Guid profileid = Guid.Parse(entity.Teacher);
                 var lstEntityprofile = service.GetData<Tra_RequirementTrainEntity>(entity.Teacher, ConstantSql.hrm_hr_sp_get_ProfileById, ref status);
                 if (lstEntityprofile!=null && lstEntityprofile.Count > 0)
                 {
                     var entityprofile = lstEntityprofile[0];
                     if (entityprofile != null && entityprofile.ProfileID != null && entityprofile.ProfileName != null)
                     {
                         model.ProfileID = entityprofile.ID;
                         model.ProfileName = entityprofile.ProfileName;
                         model.CodeEmp = entityprofile.CodeEmp;
                     }
                 }
                 
             }
     }
     model.ActionStatus = status;
     return model;
 }
Esempio n. 2
0
 /// <summary>
 /// [Chuc.Nguyen] - Xóa hoặc chuyển đổi trạng thái của Ngân Hàng(Tra_Certificate) sang IsDelete
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Tra_ClassModel DeleteOrRemove(string id)
 {
     var model = new Tra_ClassModel();
     ActionService service = new ActionService(UserLogin);
     var baseServices = new Tra_ClassServices();
     //var baseService = new BaseService();
     bool isDelete = true;
     string status = "";
     var idItem = id.Split(',');
     foreach (var item in idItem)
     {
         var idInt = Guid.Empty;
         Guid.TryParse(item, out idInt);
         if (idInt != Guid.Empty)
         {
             var objs = new List<object>();
             objs.Add(Guid.Parse(item));
             var result = baseServices.GetData<Tra_TraineeEntity>(objs, ConstantSql.hrm_cat_sp_get_TraineeByClassID, UserLogin, ref status);
             if (result != null && result.Count > 0)
             {
                 isDelete = false;
                 break;
             }
         }
     }
     if (isDelete)
         model = service.DeleteOrRemove<Tra_ClassEntity, Tra_ClassModel>(id);
     else
     {
         status = ConstantMessages.YouMustDeleteDetailRecord.TranslateString();
         model.SetPropertyValue(Constant.ActionStatus, status);
     }
     return model;
 }
        public ActionResult Create(Tra_ClassModel model)
        {

            if (ModelState.IsValid)
            {
                var service = new RestServiceClient<Tra_ClassModel>(UserLogin);
                service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
                var result = service.Put(_hrm_Hr_Service, "api/Tra_Class/", model);
                ViewBag.MsgInsert = ConstantDisplay.HRM_Att_Grade_InsertSuccess.TranslateString();
            }
            return View();
        }
 public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Tra_ClassModel Sal_Grade)
 {
     //var isAccess = CheckPermission(UserId, PrivilegeType.Modify, ConstantPermission.Att_Grade);
     //if (!isAccess)
     //{
     //    return PartialView("AccessDenied");
     //}
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient<Tra_ClassModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Hr_Service);
         var result = service.Put(_hrm_Hr_Service, "api/Tra_Class/", Sal_Grade);
         //return Json(result);
         ViewBag.MsgUpdate = ConstantDisplay.HRM_Att_Grade_UpdateSuccess.TranslateString();
     }
     return View();
 }
Esempio n. 5
0
        public ActionResult GetDataByClassID(string classID)
        {
            string status = string.Empty;
            Tra_ClassModel result = new Tra_ClassModel();
            if (classID != null && classID != string.Empty)
            {
                ActionService Base = new ActionService(UserLogin);
                result = Base.GetData<Tra_ClassModel>(Common.DotNetToOracle(classID), ConstantSql.hrm_tra_sp_get_ClassById, ref status).FirstOrDefault();
            }
            return Json(result, JsonRequestBehavior.AllowGet);

        }