예제 #1
0
        public void CRUD_Employee()
        {
            #region Commented Code

            //    public string VchNo { get; set; }
            //public int GiftTypeId { get; set; }
            //public int ReceivedFrom { get; set; }
            //public string VchTypeCode { get; set; }
            //public int VchMonth { get; set; }
            //public int VchYear { get; set; }
            //public string VchKeyId { get; set; }
            //public DateTime VchDate { get; set; }
            //public decimal VchAmount { get; set; }
            //public string PaymentMode { get; set; }
            //public string ChequeNo { get; set; }
            //public DateTime ChequeDate { get; set; }
            //public int BankId { get; set; }
            #endregion

            EmployeeCoreBE mod = new EmployeeCoreBE();
            //mod.SiteCode = "QST";
            //mod.EntityName = "Jameel";
            //mod.Phone = "111222333";

            //int pId = _bdmSvc.AddEmployee(mod);
            //int vchId = _alKhairSvc.AddVoucher(mod);

            var list = _bdmSvc.GetViewOfAllEmployees("QST");// _alKhairSvc.GetAllVouchers("QST");//.GetViewOfAllVouchers("QST");
            if (list != null && list.Count > 0)
            {
                mod = list[0];
                //mod.VchNo = " ...";
                mod.EntityName = mod.EntityName + "...";

                if (_bdmSvc.ModifyEmployee(mod))
                {

                }
                //p = _bdmSvc.GetPersonById(pv.SiteCode, pv.EntityTypeCode, pv.ID);
            }
        }
예제 #2
0
 public bool ModifyEmployee(EmployeeCoreBE mod)
 {
     return ModifyPerson(mod.ToPerson());
 }
예제 #3
0
 public int AddEmployee(EmployeeCoreBE mod)
 {
     return AddPerson(mod.ToPerson());
 }
예제 #4
0
 public EmployeeCoreViewModel()
 {
     EmployeeCore = new EmployeeCoreBE();
     //EmployeeCores = new List<EmployeeCoreView>();
     EmployeeCores = new List<EmployeeCoreBE>();
 }
예제 #5
0
        public EmployeeCoreViewModel ModifyEmployeeCore(EmployeeCoreBE mod)
        {
            EmployeeCoreViewModel model = new EmployeeCoreViewModel();

            try
            {
                DBOperations op = mod.IsActive ? DBOperations.Update : DBOperations.Delete;
                mod.SiteCode = AppConstants.SITE_CODE;
                model.EmployeeCore = mod;
                model.IsValid = model.Validate();
                if (op == DBOperations.Delete || model.IsValid)
                {
                    //_bdmSvc.ModifyEntity(mod);
                    _bdmSvc.ModifyEmployee(mod);

                    model.FieldId = "EmployeeCoreName";
                    model.EmployeeCore = new EmployeeCoreBE();
                    model.EmployeeCores = _bdmSvc.GetViewOfAllEmployees(AppConstants.SITE_CODE).Where(m => m.IsActive = true).ToList();
                    model.Message = op == DBOperations.Update ? string.Format(AppConstants.CRUD_UPDATE, "Employee Name") : string.Format(AppConstants.CRUD_DELETE, "Employee Name");
                }
            }
            catch (Exception ex)
            {
                model.IsValid = false;
                model.Message = ex.Message;
                if (ex.Message.Contains("Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions."))
                    model.Message = "Unable to modify Region Code";
            }
            return model;
        }