Ejemplo n.º 1
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_TraineeCertificateModel DeleteOrRemove(string id)
        {
            ActionService service = new ActionService(UserLogin);
            var traineeCertificateServices = new Tra_TraineeCertificateServices();
            string status = string.Empty;
            var result = new Tra_TraineeCertificateModel();
            Guid[] _TraineeIds = null;
            var Ids = id.Substring(7);
            if(Ids != null)
            {
                _TraineeIds = Ids.Split(',').Select(s => Guid.Parse(s)).ToArray();
            }
            var objTraineeCertificate = new List<object>();
            objTraineeCertificate.Add(1);
            objTraineeCertificate.Add(int.MaxValue -1);
            var lstTraineeCertificate = traineeCertificateServices.GetData<Tra_TraineeCertificateEntity>(objTraineeCertificate, ConstantSql.hrm_tra_sp_get_TraineeCertificate,UserLogin, ref status).ToList();
            if (lstTraineeCertificate != null)
            {
                lstTraineeCertificate = lstTraineeCertificate.Where(s => _TraineeIds.Contains(s.TraineeID.Value)).ToList();
            }
            var lstTraineeCertificateIds = lstTraineeCertificate.Select(s => s.ID).ToList();
            var strIds = string.Join(",", lstTraineeCertificateIds.ToArray());
            if (!string.IsNullOrEmpty(strIds))
            {
                var  strRemoveIds = DeleteType.Remove.ToString() + "," + strIds;
                result = service.DeleteOrRemove<Tra_TraineeCertificateEntity, Tra_TraineeCertificateModel>(strRemoveIds);
                return result;
            }

            return result;
            
        }
Ejemplo n.º 2
0
 /// <summary>
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Tra_TraineeCertificateModel GetById(Guid id)
 {
     string status = string.Empty;
     var model = new Tra_TraineeCertificateModel();
     ActionService service = new ActionService(UserLogin);
     var entity = service.GetByIdUseStore<Tra_TraineeCertificateEntity>(id, ConstantSql.hrm_tra_sp_get_TraineeCertificateById, ref status);
     if (entity!=null)
     {
         model = entity.CopyData<Tra_TraineeCertificateModel>();
     }
     model.ActionStatus = status;
     return model;
 }