private void FetchRecords()
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                //GET Method
                string api      = "api/CorporateCustomers/" + _PKey;
                var    response = client.GetAsync(api).Result;
                if (response.IsSuccessStatusCode)
                {
                    var a = response.Content.ReadAsStringAsync().Result;
                    CorporateCustomers corporateCustomers = JsonConvert.DeserializeObject <CorporateCustomers>(a);

                    txtCode_CorporateCustomer.Value       = corporateCustomers.code;
                    txtName_CorporateCustomer.Value       = corporateCustomers.name;
                    txtAddress1_CorporateCustomer.Value   = corporateCustomers.add1;
                    txtAddress2_CorporateCustomer.Value   = corporateCustomers.add2;
                    txtAddress3_CorporateCustomer.Value   = corporateCustomers.add3;
                    txtAddress4_CorporateCustomer.Value   = corporateCustomers.add4;
                    txtAddress5_CorporateCustomer.Value   = corporateCustomers.add5;
                    chkInActive_CorporateCustomer.Checked = (!corporateCustomers.isactive);
                }
                else
                {
                    Console.WriteLine("Internal server Error");
                }
            }
        }
        protected void Operation_Click(object sender, EventArgs e)
        {
            try
            {
                //LoadHTMLTable();
                bool xSuccess = false;
                if (Validation())
                {
                    using (var client = new HttpClient())
                    {
                        client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                        client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

                        //Save
                        if (btnCorporateOperation.InnerText.Trim() == "Add")
                        {
                            CorporateCustomers p = new CorporateCustomers
                            {
                                code     = txtCode_CorporateCustomer.Value.ToString().Trim(),
                                name     = txtName_CorporateCustomer.Value.ToString().Trim(),
                                add1     = txtAddress1_CorporateCustomer.Value.ToString().Trim(),
                                add2     = txtAddress2_CorporateCustomer.Value.ToString().Trim(),
                                add3     = txtAddress3_CorporateCustomer.Value.ToString().Trim(),
                                add4     = txtAddress4_CorporateCustomer.Value.ToString().Trim(),
                                add5     = txtAddress5_CorporateCustomer.Value.ToString().Trim(),
                                isactive = (!chkInActive_CorporateCustomer.Checked),
                            };

                            var post = client.PostAsJsonAsync <CorporateCustomers>("api/CorporateCustomers", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                ControlNosUpdate c = new ControlNosUpdate {
                                    controldescription = "Corporate Cust Code", controlnumber = Convert.ToString((Int64.Parse(_ControlNo) + 1))
                                };
                                string api = "api/ControlNos/updatecontrol";
                                post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                                post.Wait();
                                response = post.Result;
                                if (response.IsSuccessStatusCode)
                                {
                                    xSuccess = true;
                                }
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                        else  //Update
                        {
                            CorporateCustomersUpdate p = new CorporateCustomersUpdate
                            {
                                id       = Int32.Parse(_PKey),
                                code     = txtCode_CorporateCustomer.Value.ToString().Trim(),
                                name     = txtName_CorporateCustomer.Value.ToString().Trim(),
                                add1     = txtAddress1_CorporateCustomer.Value.ToString().Trim(),
                                add2     = txtAddress2_CorporateCustomer.Value.ToString().Trim(),
                                add3     = txtAddress3_CorporateCustomer.Value.ToString().Trim(),
                                add4     = txtAddress4_CorporateCustomer.Value.ToString().Trim(),
                                add5     = txtAddress5_CorporateCustomer.Value.ToString().Trim(),
                                isactive = (!chkInActive_CorporateCustomer.Checked),
                            };

                            var post = client.PutAsJsonAsync <CorporateCustomersUpdate>("api/CorporateCustomers", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                xSuccess = true;
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }

                        if (xSuccess)
                        {
                            if (btnCorporateOperation.InnerText.Trim() == "Add")
                            {
                                oCommonEngine.SetAlert(this.Page, "Customer Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                                Session["AlertMessage"] = "Customer Class Created Sucessfully...!";
                            }
                            else
                            {
                                Session["AlertMessage"] = "Customer " + " Updated Sucessfully...!";
                                Response.Redirect("CustomerMaster2.aspx?PKey=CUSTOMER");
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
            }
        }