void FillCustomerInfo()
        {
            try
            {
                customerInfo       = _customerService.Get(frmMain.customerIdx);
                customerAccountant = _customerAccountantService.Get(frmMain.customerIdx);
                customerPurchStaff = _purchasingStaffService.Get(frmMain.customerIdx);
                customerDirector   = _customerDirectorService.Get(frmMain.customerIdx);

                txtCode.Text           = customerInfo.CustomerCode;
                txtName.Text           = customerInfo.CustomerName;
                txtTaxNo.Text          = customerInfo.CustomerTaxNo;
                txtTaxDepart.Text      = customerInfo.CustomerTaxDepartment;
                cmbEnvoy.EditValue     = customerInfo.CustomerEnvoyId;
                txtAddress.Text        = customerInfo.CustomerAddress;
                chbActive.Checked      = customerInfo.CustomerActive;
                chbAppointment.Checked = customerInfo.CustomerGotAppointment;
                chbDebate.Checked      = customerInfo.CustomerDebated;

                txtAccountantName.Text        = customerAccountant.AccountantName;
                txtAccountantGsm.Text         = customerAccountant.AccountantGsm;
                txtAccountantMail.Text        = customerAccountant.AccountantMail;
                txtAccountantPhone.Text       = customerAccountant.AccountantPhone;
                dtpAccountantExpiry.EditValue = customerAccountant.AccountantExpiry;

                txtPurchasingDirector.Text = customerPurchStaff.PurchaseStaffName;
                txtPurchasingGsm.Text      = customerPurchStaff.PurchaseStaffGsm;
                txtPurchasingMail.Text     = customerPurchStaff.PurchaseStaffMail;
                txtPurchasingPhone.Text    = customerPurchStaff.PurchaseStaffPhone;

                txtDirectorName.Text  = customerDirector.DirectorName;
                txtDirectorTitle.Text = customerDirector.DirectorTitle;
                txtDirectorGsm.Text   = customerDirector.DirectorGsm;
                txtDirectorMail.Text  = customerDirector.DirectorMail;
                txtDirectorPhone.Text = customerDirector.DirectorPhone;
            }
            catch { }
        }
Beispiel #2
0
 public void UpdateWithTransaction(Customer customer, CustomerAccountant accountant, CustomerDirector director, CustomerPurchasingStaff purchasingStaff)
 {
     Update(customer);
     _customerDirectorService.Update(director);
     _customerStaffService.Update(purchasingStaff);
     _customerAccountantService.Update(accountant);
 }
Beispiel #3
0
 public void AddWithTransaction(Customer customer, CustomerAccountant accountant, CustomerDirector director, CustomerPurchasingStaff purchasingStaff)
 {
     Add(customer);
     accountant.CustomerId      = customer.CustomerId;
     director.CustomerId        = customer.CustomerId;
     purchasingStaff.CustomerId = customer.CustomerId;
     _customerAccountantService.Add(accountant);
     _customerDirectorService.Add(director);
     _customerStaffService.Add(purchasingStaff);
 }
        private void tbtnSave_ItemClick(object sender, TileItemEventArgs e)
        {
            ExceptionHandler.HandleException(() =>
            {
                if (frmMain.customerIdx != 0)
                {
                    #region Update
                    var updateCustomer = new Customer
                    {
                        CustomerId             = customerInfo.CustomerId,
                        CustomerCode           = txtCode.Text,
                        CustomerName           = txtName.Text,
                        CustomerTaxNo          = txtTaxNo.Text,
                        CustomerTaxDepartment  = txtTaxDepart.Text,
                        CustomerAddress        = txtAddress.Text,
                        CustomerActive         = chbActive.Checked,
                        CustomerDebated        = chbDebate.Checked,
                        CustomerGotAppointment = chbAppointment.Checked,
                        CustomerEnvoyId        = Convert.ToInt32(cmbEnvoy.EditValue)
                    };

                    var updateDirector = new CustomerDirector
                    {
                        DirectorId    = customerDirector.DirectorId,
                        DirectorName  = txtDirectorName.Text,
                        DirectorTitle = txtDirectorTitle.Text,
                        DirectorGsm   = txtDirectorGsm.Text,
                        DirectorMail  = txtDirectorMail.Text,
                        DirectorPhone = txtDirectorPhone.Text,
                        CustomerId    = updateCustomer.CustomerId
                    };
                    var updatePurchasingStaff = new CustomerPurchasingStaff
                    {
                        PurchaseStaffId    = customerPurchStaff.PurchaseStaffId,
                        PurchaseStaffName  = txtPurchasingDirector.Text,
                        PurchaseStaffGsm   = txtPurchasingGsm.Text,
                        PurchaseStaffMail  = txtPurchasingMail.Text,
                        PurchaseStaffPhone = txtPurchasingPhone.Text,
                        CustomerId         = updateCustomer.CustomerId
                    };
                    var updateAccountant = new CustomerAccountant
                    {
                        AccountantId     = customerAccountant.AccountantId,
                        CustomerId       = updateCustomer.CustomerId,
                        AccountantName   = txtAccountantName.Text,
                        AccountantGsm    = txtAccountantGsm.Text,
                        AccountantMail   = txtAccountantMail.Text,
                        AccountantPhone  = txtAccountantPhone.Text,
                        AccountantExpiry = dtpAccountantExpiry.DateTime
                    };
                    _customerService.UpdateWithTransaction(updateCustomer, updateAccountant, updateDirector, updatePurchasingStaff);
                    FillCustomerInfo();
                    XtraMessageBox.Show("Güncellendi.");

                    #endregion
                }
                else
                {
                    #region NewRecord
                    var newCustomerRec = new Customer
                    {
                        CustomerCode           = txtCode.Text,
                        CustomerName           = txtName.Text,
                        CustomerTaxNo          = txtTaxNo.Text,
                        CustomerTaxDepartment  = txtTaxDepart.Text,
                        CustomerAddress        = txtAddress.Text,
                        CustomerActive         = chbActive.Checked,
                        CustomerDebated        = chbDebate.Checked,
                        CustomerGotAppointment = chbAppointment.Checked,
                        CustomerEnvoyId        = Convert.ToInt32(cmbEnvoy.EditValue)
                    };

                    var newDirectorRec = new CustomerDirector
                    {
                        DirectorName  = txtDirectorName.Text,
                        DirectorTitle = txtDirectorTitle.Text,
                        DirectorGsm   = txtDirectorGsm.Text,
                        DirectorMail  = txtDirectorMail.Text,
                        DirectorPhone = txtDirectorPhone.Text,
                    };

                    var newPurchasingStaffRec = new CustomerPurchasingStaff
                    {
                        PurchaseStaffName  = txtPurchasingDirector.Text,
                        PurchaseStaffGsm   = txtPurchasingGsm.Text,
                        PurchaseStaffMail  = txtPurchasingMail.Text,
                        PurchaseStaffPhone = txtPurchasingPhone.Text,
                    };

                    var newAccountantRec = new CustomerAccountant
                    {
                        AccountantName   = txtAccountantName.Text,
                        AccountantGsm    = txtAccountantGsm.Text,
                        AccountantMail   = txtAccountantMail.Text,
                        AccountantPhone  = txtAccountantPhone.Text,
                        AccountantExpiry = dtpAccountantExpiry.DateTime
                    };
                    _customerService.AddWithTransaction(newCustomerRec, newAccountantRec, newDirectorRec, newPurchasingStaffRec);
                    frmMain.customerIdx = newCustomerRec.CustomerId;
                    FillCustomerInfo();
                    tbarDetails.Visible = true;
                    XtraMessageBox.Show("Başarıyla Oluşturuldu.");
                    #endregion
                }
            });
        }
Beispiel #5
0
        public void ImportXl(string path, ICustomerService customerService)
        {
            try
            {
                string xlConn = string
                                .Format($"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={path};Extended Properties=\"Excel 12.0;HDR=NO;\"");

                using (OleDbConnection xconn = new OleDbConnection(xlConn))
                {
                    OleDbCommand    xcmd = new OleDbCommand("select * from [Sayfa1$]", xconn);
                    OleDbDataReader xdr;

                    xconn.Open();
                    xdr = xcmd.ExecuteReader();
                    while (xdr.Read())
                    {
                        importedCustomer = new Customer
                        {
                            CustomerCode          = xdr[0].ToString(),
                            CustomerName          = xdr[1].ToString(),
                            CustomerTaxNo         = xdr[2].ToString(),
                            CustomerTaxDepartment = xdr[3].ToString(),
                            CustomerAddress       = xdr[4].ToString()
                        };

                        importedDirector = new CustomerDirector
                        {
                            CustomerId    = importedCustomer.CustomerId,
                            DirectorName  = xdr[5].ToString(),
                            DirectorTitle = xdr[6].ToString(),
                            DirectorGsm   = xdr[7].ToString(),
                            DirectorMail  = xdr[8].ToString(),
                            DirectorPhone = xdr[9].ToString()
                        };
                        importedStaff = new CustomerPurchasingStaff {
                            CustomerId         = importedCustomer.CustomerId,
                            PurchaseStaffName  = xdr[10].ToString(),
                            PurchaseStaffGsm   = xdr[11].ToString(),
                            PurchaseStaffMail  = xdr[12].ToString(),
                            PurchaseStaffPhone = xdr[13].ToString()
                        };
                        importedAccountant = new CustomerAccountant
                        {
                            CustomerId       = importedCustomer.CustomerId,
                            AccountantName   = xdr[14].ToString(),
                            AccountantGsm    = xdr[15].ToString(),
                            AccountantMail   = xdr[16].ToString(),
                            AccountantPhone  = xdr[17].ToString(),
                            AccountantExpiry = Convert.ToDateTime(xdr[18], CultureInfo.GetCultureInfo("tr-TR").DateTimeFormat)
                        };
                        customerService.AddWithTransaction(importedCustomer, importedAccountant, importedDirector, importedStaff);
                    }
                    xconn.Close();
                }
            }
            catch (Exception exception)
            {
                throw new Exception($"Hata {importedCustomer.CustomerName} " +
                                    exception.Message + "\r Hatalı kayıt Silindi.");
            }
        }
 public void Update(CustomerPurchasingStaff purchasingStaff)
 {
     _purchasingStaffDal.Update(purchasingStaff);
 }
 public void Delete(CustomerPurchasingStaff purchasingStaff)
 {
     _purchasingStaffDal.Delete(purchasingStaff);
 }
 public void Add(CustomerPurchasingStaff purchasingStaff)
 {
     _purchasingStaffDal.Add(purchasingStaff);
 }