Exemplo n.º 1
0
        public IActionResult CreateCustomer(customerDetails customer)
        {
            _log4net.Info("New Customer Creation Initiated");
            string token = TokenInfo.StringToken;

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
            string              data     = JsonConvert.SerializeObject(customer);
            StringContent       content  = new StringContent(data, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync("https://localhost:44377/api/Customer/createCustomer", content).Result;

            if (response.IsSuccessStatusCode)
            {
                string data1 = response.Content.ReadAsStringAsync().Result;
                CustomerCreationStatus ob4 = JsonConvert.DeserializeObject <CustomerCreationStatus>(data1);
                if (ob4 != null)
                {
                    return(RedirectToAction("CreationStatus", ob4));
                }
                else
                {
                    return(RedirectToAction("Error"));
                }
            }
            return(BadRequest());
        }
Exemplo n.º 2
0
        //Send print notification to front-end : Avar
        protected internal void sendPrintNotifications(string customerID)
        {
            System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection();
            DataTable       dtable  = new DataTable();
            OleDbCommand    command = new OleDbCommand();
            OleDbDataReader reader;

            connection.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=PrimaryDB.mdb";
            command.Connection          = connection;

            connection.Open();

            string query = "SELECT * from Customers where [ID] =" + customerID;

            command.CommandText = query;
            reader = command.ExecuteReader();

            customerDetails details = new customerDetails();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    if (reader["ID"].ToString() == customerID)
                    {
                        details.fname = reader["CustomerFirstName"].ToString();
                    }
                }
                reader.Close();
            }
            connection.Close();
        }
Exemplo n.º 3
0
        public customerDetails getCustomerDetails(int customerId)
        {
            var ob = new customerDetails();

            return(customers.Where(c => c.customerId == customerId).FirstOrDefault());
            //  var x = customers.Find(x => x.customerId == customerId);

            // return x;
        }
 public static int addCustomerDetails(customerDetails customer)
 {
     try
     {
         List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();
         parameter.Add(new KeyValuePair <string, object>("@customerId", customer.customerId));
         parameter.Add(new KeyValuePair <string, object>("@customerName", customer.customerName));
         parameter.Add(new KeyValuePair <string, object>("@customerAddress", customer.customerAddress));
         parameter.Add(new KeyValuePair <string, object>("@CustomerGSTNo", customer.CustomerGSTNo));
         parameter.Add(new KeyValuePair <string, object>("@isCustomerRetailer", customer.isCustomerRetailer));
         parameter.Add(new KeyValuePair <string, object>("@DOB", customer.DOB));
         parameter.Add(new KeyValuePair <string, object>("@genderId", customer.genderId));
         parameter.Add(new KeyValuePair <string, object>("@villageId", customer.villageId));
         parameter.Add(new KeyValuePair <string, object>("@customerMobileNo", customer.customerMobileNo));
         parameter.Add(new KeyValuePair <string, object>("@MobileTwo", customer.MobileTwo));
         parameter.Add(new KeyValuePair <string, object>("@MobileThree", customer.MobileThree));
         parameter.Add(new KeyValuePair <string, object>("@emailId", customer.emailId));
         parameter.Add(new KeyValuePair <string, object>("@contactPerson", customer.contactPerson));
         parameter.Add(new KeyValuePair <string, object>("@contactNo", customer.contactNo));
         parameter.Add(new KeyValuePair <string, object>("@isCreditDebit", customer.isCreditDebit));
         parameter.Add(new KeyValuePair <string, object>("@openigBalanace", customer.openigBalanace));
         parameter.Add(new KeyValuePair <string, object>("@OtherNote", customer.OtherNote));
         parameter.Add(new KeyValuePair <string, object>("@adharNo", customer.adharNo));
         if (customer.isCreditDebit == "जमा रक्कम")
         {
             customer.drAmount = customer.openigBalanace;
             customer.crAmount = 0;
         }
         if (customer.isCreditDebit == "नावे रक्कम")
         {
             customer.crAmount = customer.openigBalanace;
             customer.drAmount = 0;
         }
         parameter.Add(new KeyValuePair <string, object>("@billDate", customer.fromDate));
         parameter.Add(new KeyValuePair <string, object>("@crAmount", customer.crAmount));
         parameter.Add(new KeyValuePair <string, object>("@drAmount", customer.drAmount));
         parameter.Add(new KeyValuePair <string, object>("@isActive", 1));
         parameter.Add(new KeyValuePair <string, object>("@addedBy", customer.addedBy));
         parameter.Add(new KeyValuePair <string, object>("@addedOn", customer.addedOn));
         parameter.Add(new KeyValuePair <string, object>("@discount", customer.discount));
         parameter.Add(new KeyValuePair <string, object>("@limitationAmount", customer.limitationAmount));
         parameter.Add(new KeyValuePair <string, object>("@FinancialYearID", customer.FinancialYearID));
         parameter.Add(new KeyValuePair <string, object>("@salesmanId", customer.SalesmanId));
         parameter.Add(new KeyValuePair <string, object>("@pancardNo", customer.CustomerPANNo));
         SqlHandler sqlH = new SqlHandler();
         int        i    = sqlH.ExecuteNonQueryI("[dbo].[Usp_addCustomerDetails]", parameter);
         return(i);
     }
     catch (Exception ae)
     {
         throw ae;
     }
 }
 public static int addCustomerDetails(customerDetails customer)
 {
     try
     {
         int i = customerProvider.addCustomerDetails(customer);
         return(i);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 6
0
 public IActionResult createCustomer([FromBody] customerDetails customer)
 {
     _log4net.Info("Creation of customer is initiated");
     try
     {
         var result = customerRepository.createCustomer(customer);
         if (result == null)
         {
             return(NotFound());
         }
         _log4net.Info("New Customer account is created");
         return(Ok(result));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
 public static int addCustomerDetails(customerDetails customer)
 {
     try
     {
         List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();
         parameter.Add(new KeyValuePair <string, object>("@customerId", customer.customerId));
         parameter.Add(new KeyValuePair <string, object>("@customerName", customer.customerName));
         parameter.Add(new KeyValuePair <string, object>("@customerAddress", customer.customerAddress));
         parameter.Add(new KeyValuePair <string, object>("@DOB", customer.DOB));
         parameter.Add(new KeyValuePair <string, object>("@genderId", customer.genderId));
         parameter.Add(new KeyValuePair <string, object>("@villageId", customer.villageId));
         parameter.Add(new KeyValuePair <string, object>("@customerMobileNo", customer.customerMobileNo));
         parameter.Add(new KeyValuePair <string, object>("@alterNateCustomerMobileNo", customer.alterNateCustomerMobileNo));
         parameter.Add(new KeyValuePair <string, object>("@emailId", customer.emailId));
         parameter.Add(new KeyValuePair <string, object>("@contactPerson", customer.contactPerson));
         parameter.Add(new KeyValuePair <string, object>("@contactPersonMobileNo", customer.contactPersonMobileNo));
         parameter.Add(new KeyValuePair <string, object>("@isCreditDebit", customer.isCreditDebit));
         parameter.Add(new KeyValuePair <string, object>("@openigBalanace", customer.openigBalanace));
         if (customer.isCreditDebit == "जमा रक्कम")
         {
             customer.crAmount = customer.openigBalanace;
             customer.drAmount = 0;
         }
         if (customer.isCreditDebit == "नावे रक्कम")
         {
             customer.drAmount = customer.openigBalanace;
             customer.crAmount = 0;
         }
         parameter.Add(new KeyValuePair <string, object>("@crAmount", customer.crAmount));
         parameter.Add(new KeyValuePair <string, object>("@drAmount", customer.drAmount));
         parameter.Add(new KeyValuePair <string, object>("@orjId", customer.orjId));
         parameter.Add(new KeyValuePair <string, object>("@isActive", 1));
         parameter.Add(new KeyValuePair <string, object>("@addedBy", customer.addedBy));
         parameter.Add(new KeyValuePair <string, object>("@addedOn", customer.addedOn));
         SqlHandler sqlH = new SqlHandler();
         int        i    = sqlH.ExecuteNonQueryI("[dbo].[Usp_addCustomerDetails]", parameter);
         return(i);
     }
     catch (Exception ae)
     {
         throw ae;
     }
 }
        public CustomerCreationStatus createCustomer(customerDetails customer)
        {
            customers.Add(customer);
            string              JsonData = JsonConvert.SerializeObject(customer.customerId);
            StringContent       content  = new StringContent(JsonData, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(client.BaseAddress + "/createAccount/", content).Result;

            if (response.IsSuccessStatusCode)
            {
                string          responseData = response.Content.ReadAsStringAsync().Result;
                customerAccount createStatus = JsonConvert.DeserializeObject <customerAccount>(responseData);
                var             result       = new CustomerCreationStatus();
                result.customerId       = customer.customerId;
                result.Message          = "Success. Current and Savings account also created";
                result.currentAccountId = createStatus.currentAccountId;
                result.savingsAccountId = createStatus.savingsAccountId;
                return(result);
            }
            return(null);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                customerDetails customers = new customerDetails();
                if (txtCustomerName.Text == string.Empty)
                {
                    if (Utility.Langn == "English")
                    {
                        MessageBox.Show("Please Add Customer name ...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        MessageBox.Show("कृपया ग्राहकाचे नाव भरा ...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    txtCustomerName.Focus();
                    return;
                }
                if (cmbVillage.SelectedIndex == 0)
                {
                    if (Utility.Langn == "English")
                    {
                        MessageBox.Show(" Please add or select village name ..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        MessageBox.Show(" कृपया गावाचे नाव भरा किंवा निवडा ..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    cmbVillage.Focus();
                    return;
                }
                if (cmbCustomerRetailer.Text == "")
                {
                    if (Utility.Langn == "English")
                    {
                        MessageBox.Show("Please Select Customer /Retailer!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        MessageBox.Show("कृपया ग्राहक/ कीरकोळ विक्रेता निवडा !", "त्रुटी", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    cmbCustomerRetailer.Focus();
                    return;
                }

                if (txtOpeningBalance.Text == string.Empty)
                {
                    txtOpeningBalance.Text = "0";
                }

                customers.customerId         = customerId;
                customers.customerName       = txtCustomerName.Text.Trim();
                customers.SalesmanId         = Convert.ToInt64(cmbSalesmanName.SelectedValue);
                customers.CustomerGSTNo      = txtGSTNo.Text.Trim();
                customers.CustomerPANNo      = txtpancardno.Text.Trim();
                customers.isCustomerRetailer = cmbCustomerRetailer.SelectedItem.ToString();
                customers.customerAddress    = txtAdd1.Text.Trim();
                if (txtMobileNo.Text == string.Empty)
                {
                    customers.customerMobileNo = "";
                }
                else
                {
                    customers.customerMobileNo = Utility.ParseValueI(txtMobileNo.Text).ToString();
                }

                if (txtMobileTwo.Text == string.Empty)
                {
                    customers.MobileTwo = "";
                }
                else
                {
                    customers.MobileTwo = Utility.ParseValueI(txtMobileTwo.Text).ToString();
                }

                if (txtMobileThree.Text == string.Empty)
                {
                    customers.MobileThree = "";
                }
                else
                {
                    customers.MobileThree = Utility.ParseValueI(txtMobileThree.Text).ToString();
                }


                customers.DOB      = dtpDOB.Value;
                customers.genderId = cmbGender.Text;
                string vi = cmbVillage.Text;
                if (cmbVillage.SelectedValue == null)
                {
                    int i = villageDetailsController.addVillageDetails(0, cmbVillage.Text);
                    BindComboBoxVillageDetails();
                    cmbVillage.Text = vi;
                }

                customers.villageId = Convert.ToInt32(cmbVillage.SelectedValue);

                customers.emailId   = txtEmailID.Text.Trim();
                customers.OtherNote = txtOtherIformation.Text.Trim();
                customers.addedOn   = Utility.firstDate;
                if (txtDiscount.Text == string.Empty)
                {
                    customers.discount = 0.0;
                }
                else
                {
                    customers.discount = Utility.ParseValue(txtDiscount.Text);
                }
                if (txtlimitationAmount.Text == string.Empty)
                {
                    customers.limitationAmount = 0.0;
                }
                else
                {
                    customers.limitationAmount = Utility.ParseValue(txtlimitationAmount.Text);
                }
                if (txtOpeningBalance.Text == string.Empty)
                {
                    customers.openigBalanace = 0;
                }
                else
                {
                    customers.openigBalanace = Utility.ParseValue(txtOpeningBalance.Text);
                }
                customers.fromDate        = dateBill.Value;
                customers.isCreditDebit   = cmbCreditDebit.Text;
                customers.contactPerson   = txtContactPerson.Text;
                customers.contactNo       = txtContactPersonMobileno.Text;
                customers.adharNo         = txtAdharNo.Text.Trim();
                customers.addedBy         = Utility.LoginID;
                customers.FinancialYearID = Utility.FinancilaYearId;
                if (customers.customerId > 0)
                {
                    DialogResult ShowReport = DialogResult.No;
                    if (Utility.Langn == "English")
                    {
                        ShowReport = MessageBox.Show("Do you want to update....?", "", MessageBoxButtons.YesNo);
                    }
                    else
                    {
                        ShowReport = MessageBox.Show("तु्म्हाला अपडेट करायचं का ....?", "", MessageBoxButtons.YesNo);
                    }
                    if (ShowReport == DialogResult.Yes)
                    {
                        int i = customerController.addCustomerDetails(customers);
                        if (i > 0)
                        {
                            if (Utility.Langn == "English")
                            {
                                MessageBox.Show("Information saved successfully ..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("माहिती यशस्वीरित्या साठवली गेली ..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            btnnew_Click(sender, e);
                        }
                        if (i < 0)
                        {
                            if (Utility.Langn == "English")
                            {
                                MessageBox.Show("Customer Name already exists in list..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                            else
                            {
                                MessageBox.Show("ग्राहकाचे नाव आधीच उपलब्ध आहे ..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }
                    else
                    {
                        ShowReport = DialogResult.No;

                        btnnew_Click(sender, e);
                    }
                }
                else
                {
                    int i = customerController.addCustomerDetails(customers);
                    if (i > 0)
                    {
                        if (Utility.Langn == "English")
                        {
                            MessageBox.Show("Information saved successfully ..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("माहिती यशस्वीरित्या साठवली गेली ..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        btnnew_Click(sender, e);
                    }
                    if (i < 0)
                    {
                        if (Utility.Langn == "English")
                        {
                            MessageBox.Show("Customer Name already exists in list..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            MessageBox.Show("ग्राहकाचे नाव आधीच उपलब्ध आहे ..!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }