protected override void SaveToolStrip_Click(object sender, EventArgs e)
        {
            UpdateStatus("Saving Customer", 50);
            string[] input = { "txtPhoneNo", "txtAddress", "txtEmailID" };
            if (Utilities.Validation.IsNullOrEmpty(this, true, new List<string>(input)))
            {
                return;
            }

            if (_cust == null)
                _cust = new Customer(txtName.Text, txtMobNo.Text, txtPhoneNo.Text, txtAccountNo.Text, txtPLFNo.Text, txtAddress.Text, txtEmailID.Text);
            else
            {
                _cust.Name = txtName.Text;
                _cust.Mobile_No = txtMobNo.Text;
                _cust.Phone_No = txtPhoneNo.Text;
                _cust.AccountNo = txtAccountNo.Text;
                _cust.PLFNo = txtPLFNo.Text;
                _cust.Address = txtAddress.Text;
                _cust.Email = txtEmailID.Text;
            }

            bool success = Savers.PeoplePracticeSaver.SaveCustomerInfo(_cust);

            if (success)
            {
                UpdateStatus("Saved", 100);
                this.Close();
                return;
            }

            UpdateStatus("Error in saving Customer", 100);
        }
Ejemplo n.º 2
0
 public Sale(List<SaleItem> _items,bool _IsCredit, decimal _paidAmount, decimal _totalAmount,DateTime _dateOfSale, decimal _rebate,
             Customer _customer = null, Member _member = null,decimal _transportCharge = 0, decimal _balanceAmount = 0)
 {
     this.Items = _items;
     this.IsCredit = _IsCredit;
     this.Customer = _customer;
     this.Customer = _customer;
     this.Member = _member;
     this.TransportCharge = _transportCharge;
     this.PaidAmount = _paidAmount;
     this.BalanceAmount = _balanceAmount;
     this.TotalAmount = _totalAmount;
     this.DateOfSale = _dateOfSale;
     this.TotalRebate = _rebate;
 }
        public Winform_CustomerDetails(Customer _cust)
        {
            InitializeComponent();

            this._cust = _cust;

            /*Load Controls*/
            txtAddress.Text = _cust.Address;
            txtEmailID.Text = _cust.Email;
            txtMobNo.Text = _cust.Mobile_No;
            txtName.Text = _cust.Name;
            txtPhoneNo.Text = _cust.Phone_No;

            txtAccountNo.Text = _cust.AccountNo;
            txtPLFNo.Text = _cust.PLFNo;
        }
        protected override void dgvRegister_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DialogResult _dialogResult = MessageBox.Show("Do you want to Add Customer " +
                                         Convert.ToString(dgvRegister.Rows[e.RowIndex].Cells["Name"].Value),
                                         "Add Customer Details", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                         MessageBoxDefaultButton.Button2);

            if (_dialogResult == DialogResult.No) return;

            Customer _cust = new Customer();
            var ID = dgvRegister.Rows[e.RowIndex].Cells["ID"].Value;
            _cust = PeoplePracticeBuilder.GetCustomerInfo(int.Parse(ID.ToString()));

            Winform_SaleDetails saleDetail = Application.OpenForms["Winform_SaleDetails"] as Winform_SaleDetails;
            if (saleDetail != null)
                saleDetail.UpdateCustomerControls(_cust);

            this.Close();
        }
 public static bool SaveCustomerInfo(Customer _customer)
 {
     using (var session = NHibernateHelper.OpenSession())
     {
         using (var tx = session.BeginTransaction())
         {
             try
             {
                 session.SaveOrUpdate(_customer);
                 tx.Commit();
                 return true;
             }
             catch (Exception ex)
             {
                 log.Error(ex);
                 tx.Rollback();
                 return false;
             }
         }
     }
 }
        public void UpdateCustomerControls(Person _person)
        {
            if (rdbMember.Checked)
                this.memb = PeoplePracticeBuilder.GetMemberInfo(_person.ID);
            else
                this.cust = PeoplePracticeBuilder.GetCustomerInfo(_person.ID);

            txtName.Text = _person.Name;
            txtPhoneNo.Text = _person.Phone_No;
            txtMobNo.Text = _person.Mobile_No;
        }
        private void AddConsumerDetails()
        {
            this.cust = null;
            this.memb = null;
            this.UpdateCustomerControls(new Person());

            if (rdbMember.Checked)
                new Register.WinForm_MemberRegister().ShowDialog();
            else
                new Register.WinForm_CustomerRegister().ShowDialog();
        }