コード例 #1
0
 public void Delete(CustomerAccountant accountant)
 {
     _customerAccountantDal.Delete(accountant);
 }
コード例 #2
0
        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
                }
            });
        }
コード例 #3
0
 public void Add(CustomerAccountant accountant)
 {
     _customerAccountantDal.Add(accountant);
 }
コード例 #4
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.");
            }
        }