Exemplo n.º 1
0
        public void UpdateClient(Client client)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Db.ExecuteNonQuery("usp_Client_UpdateClient", CommandType.StoredProcedure,
                    new DbParameter[] {
                               Db.CreateParameter("ClientId", client.ClientId),
                               Db.CreateParameter("ClientName", client.ClientName),
                               Db.CreateParameter("ContactName", client.ContactName),
                               Db.CreateParameter("Phone", client.Phone),
                               Db.CreateParameter("Email", client.Email),
                               Db.CreateParameter("TIN", client.TIN),
                               Db.CreateParameter("PrivateClientDetails", client.PrivateClientDetails),
                               Db.CreateParameter("OtherClientDetails", client.OtherClientDetails),
                               Db.CreateParameter("BillingAddress", client.BillingAddress),
                               Db.CreateParameter("City", client.City),
                               Db.CreateParameter("StateCode", client.StateCode),
                               Db.CreateParameter("Zip", client.Zip),
                               Db.CreateParameter("Country", client.Country),
                               Db.CreateParameter("ShipToDifferentAddress", client.ShipToDifferentAddress),
                               Db.CreateParameter("ShippingAddress", client.ShippingAddress),
                               Db.CreateParameter("ShippingCity", client.ShippingCity),
                               Db.CreateParameter("ShippingStateCode", client.ShippingStateCode),
                               Db.CreateParameter("ShippingZip", client.ShippingZip),
                               Db.CreateParameter("ShippingCountry", client.ShippingCountry)

                 });
                scope.Complete();
            }
        }
Exemplo n.º 2
0
 public int AddClient(Client client)
 {
     using (TransactionScope scope = new TransactionScope())
     {
         DbParameter parameter = null;
         parameter = Db.CreateParameter("ClientId", DbType.Int32, 8);
         parameter.Direction = ParameterDirection.Output;
         Db.ExecuteNonQuery("usp_Client_InsertClientDetails", CommandType.StoredProcedure,
             new DbParameter[] {
                        parameter,
                        Db.CreateParameter("ClientName", client.ClientName),
                        Db.CreateParameter("ContactName", client.ContactName),
                        Db.CreateParameter("Phone", client.Phone),
                        Db.CreateParameter("Email", client.Email),
                        Db.CreateParameter("TIN", client.TIN),
                        Db.CreateParameter("PrivateClientDetails", client.PrivateClientDetails),
                        Db.CreateParameter("OtherClientDetails", client.OtherClientDetails),
                        Db.CreateParameter("BillingAddress", client.BillingAddress),
                        Db.CreateParameter("City", client.City),
                        Db.CreateParameter("StateCode", client.StateCode),
                        Db.CreateParameter("Zip", client.Zip),
                        Db.CreateParameter("Country", client.Country),
                        Db.CreateParameter("ShipToDifferentAddress", client.ShipToDifferentAddress),
                        Db.CreateParameter("ShippingAddress", client.ShippingAddress),
                        Db.CreateParameter("ShippingCity", client.ShippingCity),
                        Db.CreateParameter("ShippingStateCode", client.ShippingStateCode),
                        Db.CreateParameter("ShippingZip", client.ShippingZip),
                        Db.CreateParameter("ShippingCountry", client.ShippingCountry),
                        Db.CreateParameter("Status", client.Status)
          });
         scope.Complete();
         return (int)parameter.Value;
     }
 }
Exemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Client client = new Client();
            client.ClientName = txtClientName.Text.Trim();
            client.ContactName = txtContactName.Text.Trim();
            client.Phone = txtPhone.Text.Trim();
            client.Email = txtEmail.Text.Trim();
            client.TIN = txtTIN.Text.Trim();
            client.BillingAddress = txtBillingAddress.Text.Trim();
            client.City = txtCity.Text.Trim();
            client.Country = txtCountry.Text.Trim();
            client.Zip = txtZip.Text.Trim();
            client.StateCode = Convert.ToString(cmbState.SelectedValue);
            client.ShipToDifferentAddress = chkDifferentAddress.Checked;
            client.ShippingAddress = txtShippingAddress.Text.Trim();
            client.ShippingCity = txtShippingCity.Text.Trim();
            client.ShippingStateCode = Convert.ToString(cmbShippingState.SelectedValue);
            client.ShippingZip = txtShippingZip.Text.Trim();
            client.ShippingCountry = txtShippingCountry.Text.Trim();
            client.PrivateClientDetails = txtPrivateClientDetails.Text.Trim();
            client.OtherClientDetails = txtOtherClientDetails.Text.Trim();
            client.Status = true;
            client.CreatedDate = DateTime.Now.Date;

            if (clientID == 0)
            {
                int clientId = clientService.AddClient(client);
                ResetControls();
                CustomMessageBox.Show(string.Format(Constants.SUCCESSFULL_ADD_MESSAGE, Constants.CONSTANT_CLIENT, txtClientName.Text),
                                                              Constants.CONSTANT_INFORMATION,
                                                              Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.OK,
                                                              CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Success));
            }
            else
            {
                client.ClientId = clientID;
                clientService.UpdateClient(client);
                CustomMessageBox.Show(string.Format(Constants.SUCCESSFULL_SAVE_MESSAGE, txtClientName.Text),
                                                              Constants.CONSTANT_INFORMATION,
                                                              Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.OK,
                                                              CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Success));
            }

            this.Close();
        }
Exemplo n.º 4
0
 public void UpdateClient(Client client)
 {
     this.clientDBObj.UpdateClient(client);
 }
Exemplo n.º 5
0
 public int AddClient(Client client)
 {
     return this.clientDBObj.AddClient(client);
 }