private void Find(FrameworkElement p) { string id = ""; if (p != null) { var fe = p as Grid; if (fe != null) { foreach (var item in fe.Children) { var tx = item as TextBox; if (tx != null) { if (tx.Name.Equals("txtSearch")) { id = tx.Text; } } } } } if (!string.IsNullOrEmpty(id)) { BranchLists = new ObservableCollection <BRANCH>(BranchDao.Instance().getListByName(id)); } else { BranchLists = new ObservableCollection <BRANCH>(BranchDao.Instance().getAll()); } }
private void Save() { if (Helpers.CheckEmpty(errorProvider1, txtName, txtEmail, txtPhone, txtLocation)) { return; } else { SaveCompleted = true; errorProvider1.Clear(); BranchEntity branchEntity = new BranchEntity(); branchEntity.Name = txtName.Text; branchEntity.Email = txtEmail.Text; branchEntity.Phone = txtPhone.Text; branchEntity.Location = txtLocation.Text; branchEntity.Active = chkActive.Checked; branchEntity.CompanyId = (Guid)cboCompany.SelectedValue; if (BranchID != Guid.Empty) { branchEntity.Id = BranchID; branchEntity.Update(USER.UserName); BranchDao.Update(branchEntity); } else { branchEntity.Id = Guid.NewGuid(); branchEntity.Create(USER.UserName); BranchDao.Insert(branchEntity); } } }
private void OKevent(Window p) { EMPLOYEE em = new EMPLOYEE(); em.FIRST_NAME = EmployeeViewObj.first_name; em.LAST_NAME = EmployeeViewObj.last_name; em.TITLE = EmployeeViewObj.title; em.START_DATE = EmployeeViewObj.start_date; em.END_DATE = EmployeeViewObj.end_date; em.ASSIGNED_BRANCH_ID = BranchDao.Instance().SelectbyName(EmployeeViewObj.branch).BRANCH_ID; em.DEPT_ID = DepartmentDao.Instace().SelectbyName(EmployeeViewObj.department).DEPT_ID; em.SUPERIOR_EMP_ID = null; if (cv == "insert") { EmployeeDao.Instance().Insert(em); evm.EmployeeViewLists = evm.UpdateListview(); } else { em.EMP_ID = EmployeeViewObj.id; EmployeeDao.Instance().Update(em); evm.EmployeeViewLists = evm.UpdateListview(); } p.Close(); }
public void LoadData() { FilterEntity filterEntity = new FilterEntity(); if (rdoAllDays.Checked) { filterEntity.FromDate = null; filterEntity.ToDate = null; } else if (rdoByDate.Checked) { filterEntity.FromDate = dtpFrom.Value; filterEntity.ToDate = dtpTo.Value; } if (rdoActive.Checked) { filterEntity.Active = true; } else if (rdoInactive.Checked) { filterEntity.Active = false; } filterEntity.Keyword = txtKeyword.Text; gridList.DataSource = BranchDao.FilterListBranch(filterEntity); gridList.Refresh(); }
public BranchVM() { BranchLists = new ObservableCollection <BRANCH>(BranchDao.Instance().getAll()); FindCommand = new RelayCommand <FrameworkElement>((p) => { return(p != null ? true : false); }, (p) => { Find(p); }); EditFormCommand = new RelayCommand <BRANCH>((p) => true, (p) => { ShowEditForm(p); }); DeleteRowCommand = new RelayCommand <BRANCH>((p) => true, (p) => { Remove(p); }); NewFormCommand = new RelayCommand <Window>((p) => true, (p) => { NewEditForm(); }); }
public BranchBusiness(MardisContext mardisContext) : base(mardisContext) { _branchDao = new BranchDao(mardisContext); _sequenceBusiness = new SequenceBusiness(mardisContext); _personDao = new PersonDao(mardisContext); _branchCustomerDao = new BranchCustomerDao(mardisContext); _taskCampaignDao = new TaskCampaignDao(mardisContext); }
public CampaignBusiness(MardisContext mardisContext) : base(mardisContext) { _campaignDao = new CampaignDao(mardisContext); _sequenceBusiness = new SequenceBusiness(mardisContext); _customerDao = new CustomerDao(mardisContext); _taskCampaignDao = new TaskCampaignDao(mardisContext); _statusTaskDao = new StatusTaskDao(mardisContext); _campaignServicesDao = new CampaignServicesDao(mardisContext); _serviceDao = new ServiceDao(mardisContext); _branchDao = new BranchDao(mardisContext); _userCanpaignDao = new UserCanpaignDao(mardisContext); }
private void NewEditForm() { EmployeeEdit pro = new EmployeeEdit(); EmployeeEditVM eevm = new EmployeeEditVM(); eevm.evm = this; pro.DataContext = eevm; pro.Show(); pro.txtID.IsReadOnly = true; pro.txtBranch.ItemsSource = BranchDao.Instance().getAll(); pro.txtDepartment.ItemsSource = DepartmentDao.Instace().getAll(); }
private void OKevent(Window p) { ACCOUNT ac = new ACCOUNT(); ACC_TRANSACTION tran = new ACC_TRANSACTION(); ac.AVAIL_BALANCE = AccountViewObj.avail_balance; ac.CLOSE_DATE = AccountViewObj.close_date; ac.OPEN_DATE = AccountViewObj.open_date; ac.PENDING_BALANCE = AccountViewObj.pending_balance; ac.STATUS = AccountViewObj.status; ac.PRODUCT_CD = ProductDao.Instance().SelectbyName(AccountViewObj.product).PRODUCT_CD; ac.LAST_ACTIVITY_DATE = AccountViewObj.last_date; ac.OPEN_BRANCH_ID = BranchDao.Instance().SelectbyName(AccountViewObj.branch).BRANCH_ID; ac.OPEN_EMP_ID = FindEm(AccountViewObj.NameEm, listem); ac.CUST_ID = CustId; tran.EXECUTION_BRANCH_ID = null; tran.TELLER_EMP_ID = null; tran.FUNDS_AVAIL_DATE = Account_tranObj.fund_date; tran.AMOUNT = Account_tranObj.amount; tran.TXN_DATE = Account_tranObj.txndate; tran.TXN_TYPE_CD = Account_tranObj.txntype; if (cv == "insert") { try { AccountDao.Instance().Insert(ac, tran); } catch { throw new Exception(); } } else { using (SalesEntities3 entity = new SalesEntities3()) { try { ac.ACCOUNT_ID = AccountViewObj.id; tran.ACCOUNT_ID = AccountViewObj.id; tran.TXN_ID = Account_tranObj.txnid; AccountDao.Instance().Update(ac, tran); } catch { throw new Exception(); } } } p.Close(); vm.AccountViewLists = vm.UpdateListview(); }
private void ShowEditForm(EmployeeView pv) { if (pv != null) { EmployeeEdit pro = new EmployeeEdit(); EmployeeEditVM eevm = new EmployeeEditVM(); eevm.evm = this; eevm.EmployeeViewObj = pv; pro.DataContext = eevm; pro.Show(); pro.txtID.IsReadOnly = true; pro.txtBranch.ItemsSource = BranchDao.Instance().getAll(); pro.txtDepartment.ItemsSource = DepartmentDao.Instace().getAll(); } }
public void ListBranchInfo(int stationId) { List <BranchModel> branchList = BranchDao.GetBranch(stationId); double?latitude, longitude; string branchName; foreach (var x in branchList) { branchName = x.Name; latitude = x.Latitude; longitude = x.Longitude; this.bingGeocodeDataProviderBranchName.RequestLocationInformation(new GeoPoint((double)latitude, (double)longitude), null); } }
public Account_tran(ACC_TRANSACTION at) { if (at != null) { this.txnid = at.TXN_ID; this.amount = at.AMOUNT; this.fund_date = at.FUNDS_AVAIL_DATE; this.txndate = at.TXN_DATE; this.txntype = at.TXN_TYPE_CD; if (at.EXECUTION_BRANCH_ID != null) { this.branch = BranchDao.Instance().SelectbyId(at.EXECUTION_BRANCH_ID).NAME; } if (at.TELLER_EMP_ID != null) { this.employee = EmployeeDao.Instance().SelectbyId(at.TELLER_EMP_ID).FIRST_NAME; } } }
private void ShowEditForm(AccountView pv) { if (pv != null) { AccountEdit ac = new AccountEdit(); ac.Show(); AccountEditVM avm = new AccountEditVM(); ac.DataContext = avm; avm.vm = this; avm.AccountViewObj = AccountViewObj; avm.Account_tranObj = Account_tranObj; avm.CustId = AccountViewObj.customer.CUST_ID; avm.cv = "update"; ac.ComBranch.ItemsSource = BranchDao.Instance().getAll(); ac.ComProduct.ItemsSource = listpro; avm.listem = listem; ac.ComEm.ItemsSource = listem; } }
private void BtnSaveNew_Click(object sender, EventArgs e) { if (!chkActive.Checked) { Save(); ClearData(); } else { if (!BranchDao.CheckExistName(txtName.Text)) { Save(); ClearData(); } else { MessageBox.Show(@"Branch's name was exist", "Try again"); } } }
public FrmBranch(bool isCanSave = true, Guid?id = null) { InitializeComponent(); cboCompany.ValueMember = "ID"; cboCompany.DisplayMember = "NameInEnglish"; cboCompany.DataSource = BranchDao.GetCompanyToComboBox(); if (id != null) { BranchID = (Guid)id; BranchEntity branchEntity = new BranchEntity(); branchEntity = BranchDao.GetById(id); this.Text = this.Text + BranchID; txtName.Text = branchEntity.Name; txtEmail.Text = branchEntity.Email; txtPhone.Text = branchEntity.Phone; txtLocation.Text = branchEntity.Location; //myPicture1.SetImage(Helpers) chkActive.Checked = branchEntity.Active; cboCompany.SelectedValue = branchEntity.CompanyId; } btnSaveClose.Enabled = btnSaveNew.Enabled = isCanSave; }
public AccountView(ACCOUNT a) { this.id = a.ACCOUNT_ID; this.avail_balance = a.AVAIL_BALANCE; this.close_date = a.CLOSE_DATE; this.last_date = a.LAST_ACTIVITY_DATE; this.open_date = a.OPEN_DATE; this.pending_balance = a.PENDING_BALANCE; this.status = a.STATUS; this.branch = BranchDao.Instance().SelectbyId(a.OPEN_BRANCH_ID).NAME; this.employee = EmployeeDao.Instance().SelectbyId(a.OPEN_EMP_ID); this.NameEm = employee.FIRST_NAME + " " + employee.LAST_NAME; this.product = ProductDao.Instance().SelectbyId(a.PRODUCT_CD).NAME; this.customer = CustomerDao.Instance().SelectbyId(a.CUST_ID); if (customer.CUST_TYPE_CD == "I") { INDIVIDUAL ind = IndividualDao.Instance().SelectbyId(a.CUST_ID); if (ind == null) { this.NameCus = ""; } else { this.NameCus = ind.FIRST_NAME + " " + ind.LAST_NAME; } } else { OFFICER off = OfficerDao.Instance().SelectbyCustId(a.CUST_ID); if (off == null) { this.NameCus = ""; } else { this.NameCus = off.FIRST_NAME + " " + off.LAST_NAME; } } }
private void NewEditForm() { if (AccountViewObj != null) { AccountEdit ac = new AccountEdit(); ac.Show(); AccountEditVM avm = new AccountEditVM(); ac.DataContext = avm; avm.vm = this; avm.CustId = AccountViewObj.customer.CUST_ID; avm.AccountViewObj.NameCus = AccountViewObj.NameCus; avm.cv = "insert"; avm.listem = listem; ac.ComBranch.ItemsSource = BranchDao.Instance().getAll(); ac.ComProduct.ItemsSource = listpro; ac.ComEm.ItemsSource = listem; } else { MessageBox.Show("Chưa có tên khách hàng"); } }
private void OKevent(Window p) { BRANCH bra = new BRANCH(); bra.BRANCH_ID = int.Parse(Branch_id); bra.CITY = City; bra.ADDRESS = Address; bra.STATE = State; bra.NAME = Name; bra.ZIP_CODE = Zip_code; if (cv == "insert") { BranchDao.Instance().Insert(bra); vm.BranchLists = new ObservableCollection <BRANCH>(BranchDao.Instance().getAll()); } else { BranchDao.Instance().Update(bra); vm.BranchLists = new ObservableCollection <BRANCH>(BranchDao.Instance().getAll()); } p.Close(); }
public EmployeeView(EMPLOYEE e) { BranchDao bd = new BranchDao(); DepartmentDao dd = new DepartmentDao(); EmployeeDao ed = new EmployeeDao(); this.id = e.EMP_ID; this.end_date = e.END_DATE; this.first_name = e.FIRST_NAME; this.last_name = e.LAST_NAME; this.NameEm = e.FIRST_NAME + " " + e.LAST_NAME; this.start_date = e.START_DATE; this.title = e.TITLE; if (e.ASSIGNED_BRANCH_ID == null) { this.branch = ""; } else { this.branch = bd.SelectbyId(e.ASSIGNED_BRANCH_ID).NAME; } if (e.DEPT_ID == null) { this.department = ""; } else { this.department = dd.SelectbyId(e.DEPT_ID).NAME; } if (e.SUPERIOR_EMP_ID == null) { this.SupervisorEm = ""; } else { this.SupervisorEm = ed.SelectbyId(e.SUPERIOR_EMP_ID).FIRST_NAME; } }
public TaskCampaignBusiness(MardisContext mardisContext, RedisCache distributedCache) : base(mardisContext) { _taskCampaignDao = new TaskCampaignDao(mardisContext); _questionDetailDao = new QuestionDetailDao(mardisContext); _statusTaskBusiness = new StatusTaskBusiness(mardisContext, distributedCache); _sequenceBusiness = new SequenceBusiness(mardisContext); _campaignServicesDao = new CampaignServicesDao(mardisContext); _branchDao = new BranchDao(mardisContext); _answerDao = new AnswerDao(mardisContext); _answerDetailDao = new AnswerDetailDao(mardisContext); _branchImageBusiness = new BranchImageBusiness(mardisContext); _userDao = new UserDao(mardisContext); _campaignDao = new CampaignDao(mardisContext); _serviceDetailTaskBusiness = new ServiceDetailTaskBusiness(mardisContext); _personDao = new PersonDao(mardisContext); _profileDao = new ProfileDao(mardisContext); _typeUserBusiness = new TypeUserBusiness(mardisContext, distributedCache); _serviceDetailDao = new ServiceDetailDao(mardisContext); _questionDao = new QuestionDao(mardisContext); _redisCache = distributedCache; _serviceDetailBusiness = new ServiceDetailBusiness(mardisContext); Mapper.Initialize(cfg => { cfg.CreateMap <Service, MyTaskServicesViewModel>() .ForMember(dest => dest.ServiceDetailCollection, opt => opt.MapFrom(src => src.ServiceDetails.OrderBy(sd => sd.Order))); cfg.CreateMap <ServiceDetail, MyTaskServicesDetailViewModel>() .ForMember(dest => dest.QuestionCollection, opt => opt.MapFrom(src => src.Questions.OrderBy(q => q.Order))) .ForMember(dest => dest.Sections, opt => opt.MapFrom(src => src.Sections.OrderBy(s => s.Order))); cfg.CreateMap <Question, MyTaskQuestionsViewModel>() .ForMember(dest => dest.HasPhoto, opt => opt.MapFrom(src => src.HasPhoto.IndexOf("S", StringComparison.Ordinal) >= 0)) .ForMember(dest => dest.QuestionDetailCollection, opt => opt.MapFrom(src => src.QuestionDetails.OrderBy(qd => qd.Order))) .ForMember(dest => dest.CodeTypePoll, opt => opt.MapFrom(src => src.TypePoll.Code)); cfg.CreateMap <QuestionDetail, MyTaskQuestionDetailsViewModel>(); }); }
private void Remove(BRANCH pt) { BranchDao.Instance().Delete(pt.BRANCH_ID); BranchLists.Remove(pt); }
public void InitProcess() { var numberLine = 0; var fileContent = new StreamReader(new MemoryStream(BufferFile)); using (var mardisContext = MardisContext) { _bulkLoadBusiness = new BulkLoadBusiness(mardisContext, null); _branchDao = new BranchDao(mardisContext); _provinceDao = new ProvinceDao(mardisContext); _districtDao = new DistrictDao(mardisContext); _parishDao = new ParishDao(mardisContext); _personaDao = new PersonDao(mardisContext); _sectorDao = new SectorDao(mardisContext); _bulkLoadStatusDao = new BulkLoadStatusDao(mardisContext); var oneProcess = _bulkLoadBusiness.GetOne(IdProcess); var separatorChar = Convert.ToChar(oneProcess.BulkLoadCatalog.Separator); string line; while ((line = fileContent.ReadLine()) != null) { if (0 == numberLine) { //primera fila es cabecera numberLine++; continue; } //comienza transacción oneProcess.BulkLoadStatus = _bulkLoadStatusDao.GetOneByCode(CBulkLoad.StateBulk.EnProceso); oneProcess.IdBulkLoadStatus = oneProcess.BulkLoadStatus.Id; mardisContext.SaveChanges(); var addCurrent = 0; var updateCurrent = 0; var deleteCurrent = 0; var lineResult = line; var errorLine = string.Empty; using (var transaction = mardisContext.Database.BeginTransaction()) { try { var valuesLine = line.Split(separatorChar); var branchViewModel = ConvertViewModel(line, separatorChar); var branchTemp = _branchDao.GetBranchByExternalCode(branchViewModel.ExternalCode, IdAccount); var updateFields = false; if (null == branchTemp) { //significa que es nuevo updateFields = true; branchTemp = new Branch { Code = branchViewModel.ExternalCode, ExternalCode = branchViewModel.ExternalCode, IdAccount = IdAccount }; addCurrent++; } else { if (CBulkLoad.CharacteristicBulk.ConsevarYAdicionar.Equals(CharacteristicBulk)) { lineResult += separatorChar + "Local conservado por configuración"; _lstItemsSuccess.Add(lineResult); } else if (CBulkLoad.CharacteristicBulk.ActualizarYAdicionar.Equals(CharacteristicBulk)) { updateFields = true; } updateCurrent++; } if (updateFields) { branchTemp.Name = branchViewModel.Name; branchTemp.Label = branchViewModel.Label; var oneCountry = new Country();// _countryDao.GetCountryByCode(branchViewModel.Contry); var oneProvince = _provinceDao.GetProvinceByCode(branchViewModel.Province); var oneDistrinct = _districtDao.GetDistrinctByCode(branchViewModel.District); var oneParish = _parishDao.GetParishByCode(branchViewModel.Parish); var onePersonOwner = _personaDao.GetPersonByCode(branchViewModel.PersonOwnerCode); var oneSector = _sectorDao.GetByCode(branchViewModel.Sector); if (null != oneCountry) { branchTemp.Country = oneCountry; branchTemp.IdCountry = oneCountry.Id; } else { errorLine += "Ciudad:" + branchViewModel.Contry + " no existe,"; } if (null != oneProvince) { branchTemp.Province = oneProvince; branchTemp.IdProvince = oneProvince.Id; } else { errorLine += "Provincia:" + branchViewModel.Province + " no existe,"; } if (null != oneDistrinct) { branchTemp.District = oneDistrinct; branchTemp.IdDistrict = oneDistrinct.Id; } else { errorLine += "Distrito:" + branchViewModel.District + " no existe,"; } if (null != oneSector) { branchTemp.Sector = oneSector; branchTemp.IdSector = oneSector.Id; } else { errorLine += "Sector:" + branchViewModel.Sector + " no existe,"; } if (null != oneParish) { branchTemp.Parish = oneParish; branchTemp.IdParish = oneParish.Id; } else { errorLine += "Parroquia:" + branchViewModel.Parish + " no existe,"; } branchTemp.Zone = branchViewModel.Zone; branchTemp.Neighborhood = branchViewModel.Neighborhood; branchTemp.MainStreet = branchViewModel.MainStreet; branchTemp.SecundaryStreet = branchViewModel.SecundaryStreet; branchTemp.NumberBranch = branchViewModel.NumberBranch; branchTemp.LatitudeBranch = branchViewModel.Latitude; branchTemp.LenghtBranch = branchViewModel.Lenght; branchTemp.Reference = branchViewModel.Reference; if (null == onePersonOwner) { onePersonOwner = new Person { IdAccount = IdAccount }; } onePersonOwner.Code = branchViewModel.PersonOwnerCode; onePersonOwner.Name = branchViewModel.PersonOwnerName; onePersonOwner.SurName = branchViewModel.PersonOwnerSurname; onePersonOwner.TypeDocument = branchViewModel.PersonOwnerType; onePersonOwner.Document = branchViewModel.PersonOwnerDocument; onePersonOwner.Phone = branchViewModel.PersonOwnerPhone; onePersonOwner.Mobile = branchViewModel.PersonOwnerMobile; if (onePersonOwner.Id == Guid.Empty) { mardisContext.Persons.Add(onePersonOwner); } mardisContext.SaveChanges(); branchTemp.PersonOwner = onePersonOwner; branchTemp.IdPersonOwner = onePersonOwner.Id; branchTemp.IsAdministratorOwner = branchViewModel.IsPersonAdministrator.ToUpper(); if (CBranch.Yes.Equals(branchViewModel.IsPersonAdministrator.ToUpper())) { branchTemp.IdPersonAdministrator = null; branchTemp.PersonAdministration = null; } else if (CBranch.No.Equals(branchViewModel.IsPersonAdministrator.ToUpper())) { var onePersonAdmin = _personaDao.GetPersonByCode(branchViewModel.PersonAdminCode); if (null == onePersonAdmin) { onePersonAdmin = new Person(); mardisContext.Persons.Add(onePersonAdmin); } onePersonAdmin.Code = branchViewModel.PersonAdminCode; onePersonAdmin.Name = branchViewModel.PersonAdminName; onePersonAdmin.SurName = branchViewModel.PersonAdminSurname; onePersonAdmin.TypeDocument = branchViewModel.PersonAdminType; onePersonAdmin.Document = branchViewModel.PersonAdminDocument; onePersonAdmin.Phone = branchViewModel.PersonAdminPhone; onePersonAdmin.Mobile = branchViewModel.PersonAdminMobile; onePersonAdmin.IdAccount = IdAccount; if (onePersonAdmin.Id == Guid.Empty) { mardisContext.Persons.Add(onePersonAdmin); } mardisContext.SaveChanges(); branchTemp.IdPersonAdministrator = onePersonAdmin.Id; branchTemp.PersonAdministration = onePersonAdmin; } else { errorLine += "No se entiende si es o no Adminitrador use SI o NO,"; } } if (!string.IsNullOrEmpty(errorLine)) { throw new Exception(errorLine); } if (branchTemp.Id == Guid.Empty) { mardisContext.Branches.Add(branchTemp); } mardisContext.SaveChanges(); transaction.Commit(); _lstItemsSuccess.Add(lineResult); } catch (Exception ex) { addCurrent = 0; updateCurrent = 0; deleteCurrent = 1; transaction.Rollback(); lineResult += separatorChar + "Error linea " + numberLine + " , mensaje: " + ex.Message; _lstItemsError.Add(lineResult); } numberLine++; } oneProcess.CurrentFile = numberLine; oneProcess.TotalAdded += addCurrent; oneProcess.TotalUpdated += updateCurrent; oneProcess.TotalFailed += deleteCurrent; mardisContext.SaveChanges(); } oneProcess.BulkLoadStatus = _bulkLoadStatusDao.GetOneByCode(CBulkLoad.StateBulk.Aceptado); oneProcess.IdBulkLoadStatus = oneProcess.BulkLoadStatus.Id; mardisContext.SaveChanges(); } }
public PagosBusiness(MardisContext mardisContext) : base(mardisContext) { _pagosDao = new PagosDao(mardisContext); _branchDao = new BranchDao(mardisContext); _chequePagos = new ChequePagosDao(mardisContext); }