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); } }
public bool ModifyEmployee(EmployeeCoreBE mod) { return ModifyPerson(mod.ToPerson()); }
public int AddEmployee(EmployeeCoreBE mod) { return AddPerson(mod.ToPerson()); }
public EmployeeCoreViewModel() { EmployeeCore = new EmployeeCoreBE(); //EmployeeCores = new List<EmployeeCoreView>(); EmployeeCores = new List<EmployeeCoreBE>(); }
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; }