public static void AddCommissionGroupHrData(string code, string description, bool isactive, bool isservice,
                                                    string type, string type2, string siteCode)
        {
            if (string.IsNullOrEmpty(siteCode))
            {
                siteCode = "HQ";
            }

            if (type == "Work")
            {
                isservice = true;
                type2     = "";
            }
            else if (type == "Prepaid")
            {
                isservice = false;
            }
            else
            {
                isservice = false;
                type2     = "";
            }


            using (var client = new HttpClient())
            {
                commissionGroupHrInput p = new commissionGroupHrInput {
                    code = code, description = description, isactive = isactive, isservice = isservice,
                    type = type, type2 = type2
                };
                client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                var post = client.PostAsJsonAsync <commissionGroupHrInput>("api/CommGroupHdrs", p);
                post.Wait();
                var response = post.Result;
                System.Net.ServicePointManager.Expect100Continue = false;
                if (response.IsSuccessStatusCode)
                {
                    int Newcontrol     = int.Parse(code);
                    int NewcontrolNo   = Newcontrol + 1;
                    ControlNosUpdate c = new ControlNosUpdate {
                        controldescription = "Comm No", sitecode = siteCode, controlnumber = Convert.ToString(NewcontrolNo)
                    };
                    string api = "api/ControlNos/updatecontrol";
                    post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                    post.Wait();
                    response = post.Result;
                    if (response.IsSuccessStatusCode)
                    {
                        Console.Write("Success");
                    }
                }
                else
                {
                    var errorMessage = response.Content.ReadAsStringAsync().Result;
                    Console.Write("Error");
                }
            }
        }
Пример #2
0
        public static void AddDeptMasterData(string itmCode, string itmDesc, bool itmStatus, string itmSeq, bool allowcashsales, bool itmShowonsales, bool isfirsttrial, bool isVoucher, bool isPrepaid, bool isRetailproduct, bool isSalonproduct, bool isPackage, bool isService, bool isCompound,
                                             string validityPeriod, string validityFrom, string validityTo, string siteCode)
        {
            if (string.IsNullOrEmpty(siteCode))
            {
                siteCode = "HQ";
            }

            using (var client = new HttpClient())
            {
                deptMasterInput p = new deptMasterInput {
                    itmCode        = itmCode, itmDesc = itmDesc, itmStatus = itmStatus, itmSeq = itmSeq, allowcashsales = allowcashsales, itmShowonsales = itmShowonsales, isfirsttrial = isfirsttrial, isVoucher = isVoucher, isPrepaid = isPrepaid, isRetailproduct = isRetailproduct,
                    isSalonproduct = isSalonproduct, isPackage = isPackage, isService = isService, isCompound = isCompound,
                    validityPeriod = validityPeriod, vilidityFromDate = validityFrom, vilidityToDate = validityTo
                };
                client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                var post = client.PostAsJsonAsync <deptMasterInput>("api/ItemDepts", p);
                post.Wait();
                var response = post.Result;
                System.Net.ServicePointManager.Expect100Continue = false;
                if (response.IsSuccessStatusCode)
                {
                    int Newcontrol     = int.Parse(itmCode);
                    int NewcontrolNo   = Newcontrol + 1;
                    ControlNosUpdate c = new ControlNosUpdate {
                        controldescription = "DEPT CODE", sitecode = siteCode, controlnumber = Convert.ToString(NewcontrolNo)
                    };
                    string api = "api/ControlNos/updatecontrol";
                    post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                    post.Wait();
                    response = post.Result;
                    if (response.IsSuccessStatusCode)
                    {
                        Console.Write("Success");
                    }
                }
                else
                {
                    throw new Exception("An Error has occured with Error Code.Please contact support team");
                    var errorMessage = response.Content.ReadAsStringAsync().Result;
                    Console.Write("Error");
                }
            }
        }
Пример #3
0
 public static void DivisionMasterCall(string Code, string Name, bool InActive)
 {
     using (var client = new HttpClient())
     {
         itemDivInput p = new itemDivInput {
             itmCode = Code, itmDesc = Name, itmIsactive = InActive, itmSeq = Code
         };
         client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
         client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
         var post = client.PostAsJsonAsync <itemDivInput>("api/itemdivs", p);
         post.Wait();
         var response = post.Result;
         System.Net.ServicePointManager.Expect100Continue = false;
         if (response.IsSuccessStatusCode)
         {
             int Newcontrol     = int.Parse(Code);
             int NewcontrolNo   = Newcontrol + 1;
             ControlNosUpdate c = new ControlNosUpdate {
                 controldescription = "DIV CODE", controlnumber = Convert.ToString(NewcontrolNo)
             };
             string api = "api/ControlNos/updatecontrol";
             post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
             post.Wait();
             response = post.Result;
             if (response.IsSuccessStatusCode)
             {
                 Console.Write("Success");
             }
         }
         else
         {
             var errorMessage = response.Content.ReadAsStringAsync().Result;
             Console.Write("Error");
         }
     }
 }
Пример #4
0
        public static void AddpoDtlsData(List <poDtls> Details)
        {
            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 codeDesc = "PO";
                string api      = "api/ControlNos?filter={\"where\":{\"controlDescription\":\"" + codeDesc + "\"}}";
                var    response = client.GetAsync(api).Result;
                if (response.IsSuccessStatusCode)
                {
                    var a = response.Content.ReadAsStringAsync().Result;
                    List <ControlNos> Po = JsonConvert.DeserializeObject <List <ControlNos> >(a);
                    Details[0].poNo      = Po[0].controlPrefix + Po[0].siteCode + Po[0].controlNo;
                    Details[0].RunningNo = Po[0].controlNo;
                }
                else
                {
                    Console.WriteLine("Internal server Error");
                }
            }

            if (Details.Count > 0)
            {
                //List <StkMovdocDtls> datelist = new List<StkMovdocDtls>();

                foreach (var mc in Details)
                {
                    mc.poNo = Details[0].poNo;
                }

                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"));
                    var post = client.PostAsJsonAsync <List <poDtls> >("api/podetails", Details);
                    post.Wait();
                    var response = post.Result;
                    System.Net.ServicePointManager.Expect100Continue = false;
                    if (response.IsSuccessStatusCode)
                    {
                        if (response.IsSuccessStatusCode)
                        {
                            string           control      = Details[0].RunningNo;
                            string           controlNo    = control;
                            int              Newcontrol   = int.Parse(controlNo);
                            int              NewcontrolNo = Newcontrol + 1;
                            ControlNosUpdate c            = new ControlNosUpdate {
                                controldescription = "PO", controlnumber = Convert.ToString(NewcontrolNo)
                            };
                            string api = "api/ControlNos/updatecontrol";
                            post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                            post.Wait();
                            response = post.Result;
                            if (response.IsSuccessStatusCode)
                            {
                                Console.Write("Success");
                            }
                        }
                        else
                        {
                        }
                        var errorMessage = response.Content.ReadAsStringAsync().Result;
                        Console.Write("Success");
                    }
                    else
                    {
                        var errorMessage = response.Content.ReadAsStringAsync().Result;
                        Console.Write("Error");
                    }
                }
            }
        }
Пример #5
0
        protected void Operation_Click(object sender, EventArgs e)
        {
            try
            {
                if (Validation())
                {
                    if (btn_AddItemStatus.InnerText.Trim() == "Add")
                    {
                        using (var client = new HttpClient())
                        {
                            ItemStatus p = new ItemStatus
                            {
                                statusCode      = txtCode_ItemStatus.Value.ToString().Trim(),
                                statusDesc      = txteDesc_ItemStatus.Value.ToString().Trim(),
                                statusShortDesc = txtShortDesc_ItemStatus.Value.ToString().Trim(),
                                statusGroupCode = ddlGroup_ItemStatus.Value.ToString().Trim(),
                                itmIsactive     = chkStatusActive_ItemStatus.Checked
                            };
                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PostAsJsonAsync <ItemStatus>("api/ItemStatuses", p);
                            post.Wait();
                            var response = post.Result;


                            if (response.IsSuccessStatusCode)
                            {
                                ControlNosUpdate c = new ControlNosUpdate {
                                    controldescription = "Item Status Code", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), controlnumber = Convert.ToString((Int64.Parse(Session["ControlNo"].ToString()) + 1))
                                };
                                string api = "api/ControlNos/updatecontrol";
                                post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                                post.Wait();
                                response = post.Result;
                                if (response.IsSuccessStatusCode)
                                {
                                    txtCode_ItemStatus.Value = Session["Prefix"].ToString() + Convert.ToString((Int64.Parse(Session["ControlNo"].ToString()) + 1));
                                }
                                oCommonEngine.SetAlert(this.Page, "Item Status Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }
                    else
                    {
                        using (var client = new HttpClient())
                        {
                            ItemStatusUpdate p = new ItemStatusUpdate
                            {
                                itmId           = Int32.Parse(_PKey),
                                statusCode      = txtCode_ItemStatus.Value.ToString().Trim(),
                                statusDesc      = txteDesc_ItemStatus.Value.ToString().Trim(),
                                statusShortDesc = txtShortDesc_ItemStatus.Value.ToString().Trim(),
                                statusGroupCode = ddlGroup_ItemStatus.Value.ToString().Trim(),
                                itmIsactive     = chkStatusActive_ItemStatus.Checked
                            };
                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PutAsJsonAsync <ItemStatusUpdate>("api/ItemStatuses", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                oCommonEngine.SetAlert(this.Page, "Item Status Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }

                            CollapsiblePanelItemStatusList.Collapsed = false;
                            Get_ControlPrefixs();
                        }

                        Get_ControlPrefixs();
                    }

                    DataClear();
                    Get_ItemStatus();
                }
            }
            catch (Exception Ex)
            {
                oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
            }
        }
Пример #6
0
        protected void Operation_Click(object sender, EventArgs e)
        {
            try
            {
                //LoadHTMLTable();
                bool xSuccess = false;
                if (Validation())
                {
                    byte isActive = 0;
                    if (chkActive_VendorMaster.Checked)
                    {
                        isActive = 1;
                    }

                    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 (btnVendorOperation.InnerText.Trim() == "Add")
                        {
                            ItemSupply p = new ItemSupply
                            {
                                splyCode      = txtCode_VendorMaster.Value.ToString().Trim(),
                                supplydesc    = txtSupplierName_VendorMaster.Value.ToString().Trim(),
                                splyDate      = (txtDate_VendorMaster.Value.ToString().Substring(6, 4) + "-" + txtDate_VendorMaster.Value.ToString().Substring(3, 2) + "-" + txtDate_VendorMaster.Value.ToString().Substring(0, 2)),
                                accountNumber = txtAccountNo_VendorMaster.Value.ToString().Trim(),
                                splyAttn      = txtSupplierAtn_VendorMaster.Value.ToString().Trim(),
                                splyIc        = "",
                                splyType      = "",
                                splyAddr1     = txtAddress1_VendorMaster.Value.ToString().Trim(),
                                splyAddr2     = txtAddress2_VendorMaster.Value.ToString().Trim(),
                                splyAddr3     = txtAddress3_VendorMaster.Value.ToString().Trim(),
                                splyPoscd     = txtPostCode_VendorMaster.Value.ToString().Trim(),
                                splyState     = txtState_VendorMaster.Value.ToString().Trim(),
                                splyCity      = txtCity_VendorMaster.Value.ToString().Trim(),
                                splyCntry     = txtCountry_VendorMaster.Value.ToString().Trim(),
                                splymaddr1    = txtMailAddress1_VendorMaster.Value.ToString().Trim(),
                                splymaddr2    = txtMailAddress2_VendorMaster.Value.ToString().Trim(),
                                splymaddr3    = txtMailAddress3_VendorMaster.Value.ToString().Trim(),
                                splymposcd    = txtMailPostCode_VendorMaster.Value.ToString().Trim(),
                                splymstate    = txtMailState_VendorMaster.Value.ToString().Trim(),
                                splymcity     = txtMailCity_VendorMaster.Value.ToString().Trim(),
                                splymcntry    = txtMailCountry_VendorMaster.Value.ToString().Trim(),
                                splyTelno     = txtPhoneNo_VendorMaster.Value.ToString().Trim(),
                                splyFaxno     = txtFaxNo_VendorMaster.Value.ToString().Trim(),
                                splyRemk1     = "",
                                splyRemk2     = "",
                                splyRemk3     = "",
                                splyTerm      = txtTerms_VendorMaster.Value.ToString().Trim(),
                                splyLimit     = "0",
                                splyBal       = "0",
                                splyComm      = txtCommission_VendorMaster.Value.ToString().Trim(),
                                firstName     = "",
                                netseq        = "0",
                                splyactive    = isActive,
                                createUser    = "",
                                createDate    = (txtDate_VendorMaster.Value.ToString().Substring(6, 4) + "-" + txtDate_VendorMaster.Value.ToString().Substring(3, 2) + "-" + txtDate_VendorMaster.Value.ToString().Substring(0, 2))
                            };

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

                            if (response.IsSuccessStatusCode)
                            {
                                Console.Write("Success");
                                //int NewcontrolNo = int.Parse(_ControlNo) + 1;
                                int NewcontrolNo = 0;
                                if (String.IsNullOrEmpty(_ControlNo))
                                {
                                    NewcontrolNo = 0;
                                }
                                else
                                {
                                    NewcontrolNo = int.Parse(_ControlNo);
                                }
                                NewcontrolNo = NewcontrolNo + 1;
                                ControlNosUpdate c = new ControlNosUpdate {
                                    controldescription = "Supplier Code", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), controlnumber = Convert.ToString(NewcontrolNo)
                                };
                                string api = "api/ControlNos/updatecontrol";
                                post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                                post.Wait();
                                response = post.Result;
                                if (response.IsSuccessStatusCode)
                                {
                                    Console.Write("Success");
                                }
                                Response.Redirect("VendorList.aspx");
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                        else  //Update
                        {
                            ItemSupplyUpdate p = new ItemSupplyUpdate
                            {
                                //splyId = Int32.Parse(_PKey),
                                splyCode      = txtCode_VendorMaster.Value.ToString().Trim(),
                                supplydesc    = txtSupplierName_VendorMaster.Value.ToString().Trim(),
                                splyDate      = (txtDate_VendorMaster.Value.ToString().Substring(6, 4) + "-" + txtDate_VendorMaster.Value.ToString().Substring(3, 2) + "-" + txtDate_VendorMaster.Value.ToString().Substring(0, 2)),
                                accountNumber = txtAccountNo_VendorMaster.Value.ToString().Trim(),
                                splyAttn      = txtSupplierAtn_VendorMaster.Value.ToString().Trim(),
                                splyIc        = "",
                                splyType      = "",
                                splyAddr1     = txtAddress1_VendorMaster.Value.ToString().Trim(),
                                splyAddr2     = txtAddress2_VendorMaster.Value.ToString().Trim(),
                                splyAddr3     = txtAddress3_VendorMaster.Value.ToString().Trim(),
                                splyPoscd     = txtPostCode_VendorMaster.Value.ToString().Trim(),
                                splyState     = txtState_VendorMaster.Value.ToString().Trim(),
                                splyCity      = txtCity_VendorMaster.Value.ToString().Trim(),
                                splyCntry     = txtCountry_VendorMaster.Value.ToString().Trim(),
                                splymaddr1    = txtMailAddress1_VendorMaster.Value.ToString().Trim(),
                                splymaddr2    = txtMailAddress2_VendorMaster.Value.ToString().Trim(),
                                splymaddr3    = txtMailAddress3_VendorMaster.Value.ToString().Trim(),
                                splymposcd    = txtMailPostCode_VendorMaster.Value.ToString().Trim(),
                                splymstate    = txtMailState_VendorMaster.Value.ToString().Trim(),
                                splymcity     = txtMailCity_VendorMaster.Value.ToString().Trim(),
                                splymcntry    = txtMailCountry_VendorMaster.Value.ToString().Trim(),
                                splyTelno     = txtPhoneNo_VendorMaster.Value.ToString().Trim(),
                                splyFaxno     = txtFaxNo_VendorMaster.Value.ToString().Trim(),
                                splyRemk1     = "",
                                splyRemk2     = "",
                                splyRemk3     = "",
                                splyTerm      = Convert.ToInt32(txtTerms_VendorMaster.Value.ToString()),
                                splyLimit     = 0,
                                splyBal       = 0,
                                splyComm      = Convert.ToInt32(txtCommission_VendorMaster.Value),
                                firstName     = "",
                                netseq        = "",
                                splyactive    = isActive,
                                createUser    = "",
                                createDate    = (txtDate_VendorMaster.Value.ToString().Substring(6, 4) + "-" + txtDate_VendorMaster.Value.ToString().Substring(3, 2) + "-" + txtDate_VendorMaster.Value.ToString().Substring(0, 2)),
                            };

                            //var post = client.PutAsJsonAsync<ItemSupplyUpdate>("api/ItemSupplies", p);
                            var post = client.PostAsJsonAsync <ItemSupplyUpdate>("api/ItemSupplies/update?[where][splyCode]=" + txtCode_VendorMaster.Value.ToString() + "", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                xSuccess = true;
                            }
                            else
                            {
                                var errorMessage = response.Content.ReadAsStringAsync().Result;
                                Console.Write("Error");
                            }
                        }

                        if (xSuccess)
                        {
                            if (btnVendorOperation.InnerText.Trim() == "Add")
                            {
                                oCommonEngine.SetAlert(this.Page, "Item Vendor Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                                Session["AlertMessage"] = "Customer Class Created Sucessfully...!";
                                Response.Redirect("VendorList.aspx");
                            }
                            else
                            {
                                Session["AlertMessage"] = "Item Vendor " + " Updated Sucessfully...!";
                                Response.Redirect("VendorList.aspx");
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
            }
        }
Пример #7
0
        protected void Operation_Click(object sender, EventArgs e)
        {
            try
            {
                if (Validation())
                {
                    if (btn_AddEmployeeLevel.InnerText.Trim() == "Add")
                    {
                        using (var client = new HttpClient())
                        {
                            EmployeeLevelInsert p = new EmployeeLevelInsert
                            {
                                levelCode     = txt_EmpLevelCode.Value.ToString().Trim(),
                                levelDesc     = txt_EmpLevelDesc.Value.ToString().Trim(),
                                levelSequence = txt_EmpLevelSequence.Value.ToString().Trim(),
                                levelSpa      = chkAllowAllSpa.Checked,
                                levelIsActive = chkActive.Checked,
                                getGroupComm  = false,
                                minTarget     = "0",
                                fromSalary    = "0",
                                toSalary      = "0"
                            };

                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PostAsJsonAsync <EmployeeLevelInsert>("api/EmpLevels", p);
                            post.Wait();
                            var response = post.Result;


                            if (response.IsSuccessStatusCode)
                            {
                                var a = response.Content.ReadAsStringAsync().Result;
                                CustomerClassUpdate customerClassesUpdates = JsonConvert.DeserializeObject <CustomerClassUpdate>(a);
                                ControlNosUpdate    c = new ControlNosUpdate {
                                    controldescription = "EmpLevel Code", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), controlnumber = Convert.ToString((Int64.Parse(txt_EmpLevelCode.Value.ToString()) + 1))
                                };
                                string api = "api/ControlNos/updatecontrol";
                                post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                                post.Wait();
                                response = post.Result;
                                if (response.IsSuccessStatusCode)
                                {
                                    txt_EmpLevelCode.Value = Convert.ToString((Int64.Parse(txt_EmpLevelCode.Value.ToString()) + 1));
                                }
                                oCommonEngine.SetAlert(this.Page, "Employee Level Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }
                    else
                    {
                        using (var client = new HttpClient())
                        {
                            EmployeeLevelUpdate p = new EmployeeLevelUpdate
                            {
                                id            = int.Parse(Session["id"].ToString()),
                                levelCode     = txt_EmpLevelCode.Value.ToString().Trim(),
                                levelDesc     = txt_EmpLevelDesc.Value.ToString().Trim(),
                                levelSequence = txt_EmpLevelSequence.Value.ToString().Trim(),
                                levelSpa      = chkAllowAllSpa.Checked,
                                levelIsActive = chkActive.Checked,
                                getGroupComm  = false,
                                minTarget     = "0",
                                fromSalary    = "0",
                                toSalary      = "0"
                            };


                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PutAsJsonAsync <EmployeeLevelUpdate>("api/EmpLevels", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                oCommonEngine.SetAlert(this.Page, "Employee Level Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }

                            Get_ControlPrefixs();
                        }
                    }

                    DataClear();
                    Get_EmpLevels();
                }
            }
            catch (Exception Ex)
            {
                oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
            }
        }
Пример #8
0
        protected void Operation_Click(object sender, EventArgs e)
        {
            try
            {
                if (Validation())
                {
                    if (btn_AddRoom.InnerText.Trim() == "Add")
                    {
                        using (var client = new HttpClient())
                        {
                            RoomsList p = new RoomsList
                            {
                                roomCode    = txtCode_Room.Value.ToString().Trim(),
                                siteCode    = ddlSiteCode_Room.Value.ToString().Trim(),
                                description = txteDesc_Room.Value.ToString().Trim(),
                                displayname = txt_RoomNo.Value.ToString().Trim(),
                                // equipment = ddlEquipment.Value.ToString().Trim(),
                                isactive = chkRoomActive_Room.Checked,
                            };
                            System.Collections.Generic.List <string> sc = new System.Collections.Generic.List <string>();
                            foreach (ListItem item in ddlEquipment.Items)
                            {
                                if (item.Selected)
                                {
                                    sc.Add(item.Text);
                                }
                            }


                            string csv = String.Join("/", sc.ToArray());

                            //  csv = ddlEquipment.Value.ToString().Trim();

                            p.equipment = csv;



                            if (rbtn_SingleRoom.Checked)
                            {
                                p.roomtype = rbtn_SingleRoom.Value.ToString().Trim();
                            }
                            else if (rbtn_Double.Checked)
                            {
                                p.roomtype = rbtn_Double.Value.ToString().Trim();
                            }
                            else if (rbtn_TripleRoom.Checked)
                            {
                                p.roomtype = rbtn_TripleRoom.Value.ToString().Trim();
                            }
                            else if (rbtn_QuadRoom.Checked)
                            {
                                p.roomtype = rbtn_QuadRoom.Value.ToString().Trim();
                            }
                            else if (rbtn_Twin.Checked)
                            {
                                p.roomtype = rbtn_Twin.Value.ToString().Trim();
                            }
                            else if (rbtn_Family.Checked)
                            {
                                p.roomtype = rbtn_Family.Value.ToString().Trim();
                            }
                            else if (rbtn_King.Checked)
                            {
                                p.roomtype = rbtn_King.Value.ToString().Trim();
                            }
                            else if (rbtn_Queen.Checked)
                            {
                                p.roomtype = rbtn_Queen.Value.ToString().Trim();
                            }


                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PostAsJsonAsync <RoomsList>("api/Rooms", p);
                            post.Wait();
                            var response = post.Result;


                            if (response.IsSuccessStatusCode)
                            {
                                var a = response.Content.ReadAsStringAsync().Result;
                                CustomerClassUpdate customerClassesUpdates = JsonConvert.DeserializeObject <CustomerClassUpdate>(a);
                                ControlNosUpdate    c = new ControlNosUpdate {
                                    controldescription = "Room Code", controlnumber = Convert.ToString((Int64.Parse(txtCode_Room.Value.ToString()) + 1))
                                };
                                string api = "api/ControlNos/updatecontrol";
                                post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                                post.Wait();
                                response = post.Result;
                                if (response.IsSuccessStatusCode)
                                {
                                    txtCode_Room.Value = Convert.ToString((Int64.Parse(txtCode_Room.Value.ToString()) + 1));
                                }
                                oCommonEngine.SetAlert(this.Page, "Room Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }
                    else
                    {
                        using (var client = new HttpClient())
                        {
                            RoomsList p = new RoomsList
                            {
                                roomCode    = txtCode_Room.Value.ToString().Trim(),
                                siteCode    = ddlSiteCode_Room.Value.ToString().Trim(),
                                description = txteDesc_Room.Value.ToString().Trim(),
                                displayname = txt_RoomNo.Value.ToString().Trim(),
                                equipment   = ddlEquipment.Value.ToString().Trim(),
                                isactive    = chkRoomActive_Room.Checked
                            };

                            System.Collections.Generic.List <string> sc = new System.Collections.Generic.List <string>();
                            foreach (ListItem item in ddlEquipment.Items)
                            {
                                if (item.Selected)
                                {
                                    sc.Add(item.Text);
                                }
                            }


                            string csv = String.Join("/", sc.ToArray());

                            //  csv = ddlEquipment.Value.ToString().Trim();

                            p.equipment = csv;


                            if (rbtn_SingleRoom.Checked)
                            {
                                p.roomtype = rbtn_SingleRoom.Value.ToString().Trim();
                            }
                            else if (rbtn_Double.Checked)
                            {
                                p.roomtype = rbtn_Double.Value.ToString().Trim();
                            }
                            else if (rbtn_TripleRoom.Checked)
                            {
                                p.roomtype = rbtn_TripleRoom.Value.ToString().Trim();
                            }
                            else if (rbtn_QuadRoom.Checked)
                            {
                                p.roomtype = rbtn_QuadRoom.Value.ToString().Trim();
                            }
                            else if (rbtn_Twin.Checked)
                            {
                                p.roomtype = rbtn_Twin.Value.ToString().Trim();
                            }
                            else if (rbtn_Family.Checked)
                            {
                                p.roomtype = rbtn_Family.Value.ToString().Trim();
                            }
                            else if (rbtn_King.Checked)
                            {
                                p.roomtype = rbtn_King.Value.ToString().Trim();
                            }
                            else if (rbtn_Queen.Checked)
                            {
                                p.roomtype = rbtn_Queen.Value.ToString().Trim();
                            }
                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PutAsJsonAsync <RoomsList>("api/Rooms", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                oCommonEngine.SetAlert(this.Page, "Room Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }

                    DataClear();
                    Get_Rooms();
                }
            }
            catch (Exception Ex)
            {
                oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
            }
        }
Пример #9
0
        protected void Operation_Click(object sender, EventArgs e)
        {
            try
            {
                //LoadHTMLTable();
                bool xSuccess = false;
                int  xClassid = 0;

                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 (btnOperation.InnerText.Trim() == "Add")
                        {
                            CustomerClasses p = new CustomerClasses
                            {
                                classCode     = txtCode_CustomerClass.Value.ToString().Trim(),
                                classDesc     = txtName_CustomerClass.Value.ToString().Trim(),
                                classIsactive = (!chkInActive_CustomerClass.Checked),
                                classProduct  = 0,
                                classService  = 0
                            };
                            var post = client.PostAsJsonAsync <CustomerClasses>("api/CustomerClasses", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                var a = response.Content.ReadAsStringAsync().Result;
                                CustomerClassUpdate customerClassesUpdates = JsonConvert.DeserializeObject <CustomerClassUpdate>(a);
                                xClassid = customerClassesUpdates.id;

                                ControlNosUpdate c = new ControlNosUpdate {
                                    controldescription = "Customer Class Code", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), 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;
                                    Response.Redirect("CustomerMaster.aspx");
                                }
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                        else  //Update
                        {
                            CustomerClassUpdate p = new CustomerClassUpdate
                            {
                                classCode     = txtCode_CustomerClass.Value.ToString().Trim(),
                                classDesc     = txtName_CustomerClass.Value.ToString().Trim(),
                                classIsactive = (!chkInActive_CustomerClass.Checked),
                                classProduct  = 0,
                                classService  = 0,
                                id            = Int32.Parse(_PKey)
                            };
                            xClassid = Int32.Parse(_PKey);
                            var post = client.PutAsJsonAsync <CustomerClassUpdate>("api/CustomerClasses", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                xSuccess = true;

                                //string api = "api/Departmentaldiscounts/10";
                                //post = client.DeleteAsync(api);
                                //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);
                            }
                        }


                        if (xSuccess)
                        {
                            if (btnOperation.InnerText.Trim() == "Add")
                            {
                                oCommonEngine.SetAlert(this.Page, "Customer Class Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                                Session["AlertMessage"]     = "Customer Class Created Sucessfully...!";
                                txtCode_CustomerClass.Value = Convert.ToString((Int64.Parse(_ControlNo) + 1));
                                txtName_CustomerClass.Value = string.Empty;
                                LoadDepartments();
                            }
                            else
                            {
                                Session["AlertMessage"] = "Customer Class " + " Updated Sucessfully...!";
                                Response.Redirect("CustomerMaster.aspx?PKey=CLASS");
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
            }
        }
Пример #10
0
        protected void Operation_Click2(object sender, EventArgs e)
        {
            try
            {
                if (Validation2())
                {
                    if (btn_AddTaxType2.InnerText.Trim() == "Add")
                    {
                        using (var client = new HttpClient())
                        {
                            TaxTypeMaster p = new TaxTypeMaster
                            {
                                itemCode       = txt_itemCode2.Value.ToString().Trim(),
                                taxCode        = txt_TaxCode2.Value.ToString().Trim(),
                                taxDesc        = txt_TaxDesc2.Value.ToString().Trim(),
                                taxRatePercent = txt_TaxPercent2.Value.ToString().Trim(),
                                isactive       = chk_ActiveTaxType2.Checked
                                                 //  siteCode = txt_SiteCode.Value.ToString().Trim(),
                            };


                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PostAsJsonAsync <TaxTypeMaster>("api/TaxType2TaxCodes", p);
                            post.Wait();
                            var response = post.Result;


                            if (response.IsSuccessStatusCode)
                            {
                                ControlNosUpdate c = new ControlNosUpdate {
                                    controldescription = "2nd Tax Code", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), controlnumber = Convert.ToString((Int64.Parse(Session["ControlNo_Tax2"].ToString()) + 1))
                                };
                                string api = "api/ControlNos/updatecontrol";
                                post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                                post.Wait();
                                response = post.Result;
                                if (response.IsSuccessStatusCode)
                                {
                                    oCommonEngine.SetAlert(this.Page, "2nd Tax Code Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                                }
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }
                    else
                    {
                        using (var client = new HttpClient())
                        {
                            TaxTypeMasterUpdate p = new TaxTypeMasterUpdate
                            {
                                id             = int.Parse(Session["id"].ToString()),
                                itemCode       = txt_itemCode2.Value.ToString().Trim(),
                                taxCode        = txt_TaxCode2.Value.ToString().Trim(),
                                taxDesc        = txt_TaxDesc2.Value.ToString().Trim(),
                                taxRatePercent = txt_TaxPercent2.Value.ToString().Trim(),
                                isactive       = chk_ActiveTaxType2.Checked
                                                 //  siteCode = txt_SiteCode.Value.ToString().Trim(),
                            };
                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PutAsJsonAsync <TaxTypeMasterUpdate>("api/TaxType2TaxCodes", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                oCommonEngine.SetAlert(this.Page, "2nd Tax Code Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }

                    DataClear2();
                    Get_ControlPrefixs();
                    Get_1stTaxType();
                    Get_2ndTaxType();
                }
            }
            catch (Exception Ex)
            {
                oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
            }
        }
Пример #11
0
        protected void Operation_Click(object sender, EventArgs e)
        {
            try
            {
                if (Validation())
                {
                    if (btn_AddFOCReason.InnerText.Trim() == "Add")
                    {
                        using (var client = new HttpClient())
                        {
                            FocReason p = new FocReason
                            {
                                focReasonCode     = txtCode_FOCReason.Value.ToString().Trim(),
                                focReasonLdesc    = txtDesc_FOCReason.Value.ToString().Trim(),
                                focReasonSdesc    = txtShortDesc_FOCReason.Value.ToString().Trim(),
                                focReasonIsactive = chkStatusActive_FOCReason.Checked,
                            };


                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PostAsJsonAsync <FocReason>("api/FocReasons", p);
                            post.Wait();
                            var response = post.Result;


                            if (response.IsSuccessStatusCode)
                            {
                                //Console.Write("Success");
                                int NewcontrolNo   = int.Parse(txtControlNo.Text) + 1;
                                ControlNosUpdate c = new ControlNosUpdate {
                                    controldescription = "FOC Reason Code", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), controlnumber = Convert.ToString(NewcontrolNo)
                                };
                                string api = "api/ControlNos/updatecontrol";
                                post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                                post.Wait();
                                response = post.Result;
                                if (response.IsSuccessStatusCode)
                                {
                                    txtCode_FOCReason.Value = txtPrefix.Text + NewcontrolNo;
                                    oCommonEngine.SetAlert(this.Page, "FOC Reasons Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                                }
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }
                    else
                    {
                        using (var client = new HttpClient())
                        {
                            FocReasonUpdate p = new FocReasonUpdate
                            {
                                id                = int.Parse(Session["id"].ToString()),
                                focReasonCode     = txtCode_FOCReason.Value.ToString().Trim(),
                                focReasonLdesc    = txtDesc_FOCReason.Value.ToString().Trim(),
                                focReasonSdesc    = txtShortDesc_FOCReason.Value.ToString().Trim(),
                                focReasonIsactive = chkStatusActive_FOCReason.Checked,
                            };
                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PutAsJsonAsync <FocReasonUpdate>("api/FocReasons", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                oCommonEngine.SetAlert(this.Page, "FOC Reasons Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);

                                //   Get_FOCReasons();
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }

                        Get_ControlPrefixs();
                    }

                    DataClear();
                    Get_FOCReasons();
                }
            }
            catch (Exception Ex)
            {
                oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
            }
        }
        protected void Operation_Click(object sender, EventArgs e)
        {
            try
            {
                if (Validation())
                {
                    if (btnSubmit_AddApptStatusMaster.InnerText.Trim() == "Add")
                    {
                        using (var client = new HttpClient())
                        {
                            ApptBookingStatus p = new ApptBookingStatus
                            {
                                bsCode      = txtCode_ApptBookingStatus.Value.ToString().Trim(),
                                bsDesc      = txtDesc_ApptBookingStatus.Value.ToString().Trim(),
                                bsColorCode = txtColor.Text.ToString().Trim(),
                                active      = chk_ApptBookingStatus.Checked
                            };


                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PostAsJsonAsync <ApptBookingStatus>("api/ApptBookingStatuses", p);
                            post.Wait();
                            var response = post.Result;


                            if (response.IsSuccessStatusCode)
                            {
                                var a = response.Content.ReadAsStringAsync().Result;
                                CustomerClassUpdate customerClassesUpdates = JsonConvert.DeserializeObject <CustomerClassUpdate>(a);
                                ControlNosUpdate    c = new ControlNosUpdate {
                                    controldescription = "APPOINTMENT BOOKING STATUS", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), controlnumber = Convert.ToString((Int64.Parse(txtCode_ApptBookingStatus.Value.ToString()) + 1))
                                };
                                string api = "api/ControlNos/updatecontrol";
                                post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                                post.Wait();
                                response = post.Result;
                                if (response.IsSuccessStatusCode)
                                {
                                    txtCode_ApptBookingStatus.Value = Convert.ToString((Int64.Parse(txtCode_ApptBookingStatus.Value.ToString()) + 1));
                                }
                                oCommonEngine.SetAlert(this.Page, "Appointment Booking Status Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }
                    else
                    {
                        using (var client = new HttpClient())
                        {
                            ApptBookingStatusUpdate p = new ApptBookingStatusUpdate
                            {
                                bsCode      = txtCode_ApptBookingStatus.Value.ToString().Trim(),
                                bsDesc      = txtDesc_ApptBookingStatus.Value.ToString().Trim(),
                                bsColorCode = txtColor.Text.ToString().Trim(),
                                active      = chk_ApptBookingStatus.Checked
                            };


                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PostAsJsonAsync <ApptBookingStatusUpdate>("api/ApptBookingStatuses/update?[where][bsCode]=" + txtCode_ApptBookingStatus.Value.ToString() + "", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                oCommonEngine.SetAlert(this.Page, "Appointment Booking Status Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                                Response.Redirect("ConfigInterface_ApptBookingStatus.aspx");
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }

                    DataClear();
                }
            }
            catch (Exception Ex)
            {
                oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
            }
        }
Пример #13
0
        protected void Operation_Click(object sender, EventArgs e)
        {
            try
            {
                if (Validation())
                {
                    if (btnSubmit_AddEquipmentMaster.InnerText.Trim() == "Add")
                    {
                        using (var client = new HttpClient())
                        {
                            EquipmentList p = new EquipmentList
                            {
                                //id = int.Parse(txtEquipmentTableID.Value.ToString().Trim()),
                                equipmentCode        = txtEquipmentID_ConfigInterface.Value.ToString().Trim(),
                                equipmentName        = txtEquipmentName_ConfigInterface.Value.ToString().Trim(),
                                equipmentDescription = txtEquipmentDescription_ConfigInterface.Value.ToString().Trim(),
                                equipmentIsactive    = chk_ActiveEquipment.Checked
                            };
                            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]);
                            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                            var post = client.PostAsJsonAsync <EquipmentList>("api/Myequipments", p);
                            post.Wait();
                            var response = post.Result;


                            if (response.IsSuccessStatusCode)
                            {
                                ControlNosUpdate c = new ControlNosUpdate {
                                    controldescription = "Equipment Code", controlnumber = Convert.ToString((Int64.Parse(Session["ControlNo"].ToString()) + 1))
                                };
                                string api = "api/ControlNos/updatecontrol";
                                post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                                post.Wait();
                                response = post.Result;
                                if (response.IsSuccessStatusCode)
                                {
                                    Response.Redirect("ConfigInterface_EquipmentsList.aspx");
                                }

                                oCommonEngine.SetAlert(this.Page, "Equipment Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }
                    else
                    {
                        using (var client = new HttpClient())
                        {
                            EquipmentListUpdate p = new EquipmentListUpdate
                            {
                                //id = Int32.Parse(_PKey),
                                id                   = int.Parse(Session["id"].ToString()),
                                equipmentName        = txtEquipmentName_ConfigInterface.Value.ToString().Trim(),
                                equipmentDescription = txtEquipmentDescription_ConfigInterface.Value.ToString().Trim(),
                                equipmentIsactive    = chk_ActiveEquipment.Checked,
                                equipmentCode        = txtEquipmentID_ConfigInterface.Value.ToString().Trim()
                            };
                            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"));
                            //var post = client.PutAsJsonAsync<EquipmentListUpdate>("api/Myequipments/replaceOrCreate", p);
                            var post = client.PostAsJsonAsync <EquipmentListUpdate>("api/Myequipments/replaceOrCreate", p);
                            post.Wait();
                            var response = post.Result;

                            if (response.IsSuccessStatusCode)
                            {
                                Response.Redirect("ConfigInterface_EquipmentsList.aspx");
                                oCommonEngine.SetAlert(this.Page, "Equipment Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short);
                                Server.Execute("ConfigInterface.aspx");
                            }
                            else
                            {
                                oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
                            }
                        }
                    }

                    DataClear();
                }
            }
            catch (Exception Ex)
            {
                oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short);
            }
        }
        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);
            }
        }
        public static void EditCommissionDetailListing(List <commDetailListingDataFetch> Details)
        {
            List <commDetailListingData>      insertCommDetailList = new List <commDetailListingData>();
            List <commDetailListingDataFetch> updateCommDetailList = new List <commDetailListingDataFetch>();

            if (Details.Count > 0)
            {
                // to get commission detail control no.
                Int64 controlNo = 0;
                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 codeDesc = "Comm Detail Code";
                    string api      = "api/ControlNos?filter={\"where\":{\"controlDescription\":\"" + codeDesc + "\"}}";
                    var    response = client.GetAsync(api).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        var a = response.Content.ReadAsStringAsync().Result;
                        List <ControlNos> depts = JsonConvert.DeserializeObject <List <ControlNos> >(a);
                        if (depts.Count > 0)
                        {
                            controlNo = Int64.Parse(depts[0].controlNo);
                        }
                    }
                }

                for (int i = 0; i < Details.Count; i++)
                {
                    if (string.IsNullOrEmpty(Details[i].commDtlCode))
                    {
                        Details[i].commDtlCode = Convert.ToString(controlNo);
                        controlNo += 1;
                        commDetailListingData insertCommDetailData = new commDetailListingData();
                        insertCommDetailData.code             = Details[i].code;
                        insertCommDetailData.commLevel        = Details[i].commLevel;
                        insertCommDetailData.commValue        = Details[i].commValue;
                        insertCommDetailData.ispercent        = Details[i].ispercent;
                        insertCommDetailData.isactive         = Details[i].isactive;
                        insertCommDetailData.isdiscaffect     = Details[i].isdiscaffect;
                        insertCommDetailData.fscale           = Details[i].fscale;
                        insertCommDetailData.tscale           = Details[i].tscale;
                        insertCommDetailData.level            = Details[i].level;
                        insertCommDetailData.commDtlCode      = Details[i].commDtlCode;
                        insertCommDetailData.commBalValue     = Details[i].commBalValue;
                        insertCommDetailData.commBalIspercent = Details[i].commBalIspercent;
                        insertCommDetailData.calmethod        = Details[i].calmethod;
                        insertCommDetailList.Add(insertCommDetailData);
                    }
                    else
                    {
                        updateCommDetailList.Add(Details[i]);
                    }
                }

                //Update Commisson details
                if (updateCommDetailList.Count > 0)
                {
                    for (int i = 0; i < updateCommDetailList.Count; i++)
                    {
                        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"));
                            var post = client.PutAsJsonAsync <commDetailListingDataFetch>("api/CommGroupDtls", updateCommDetailList[i]);
                            post.Wait();
                            var response = post.Result;
                            System.Net.ServicePointManager.Expect100Continue = false;
                            if (response.IsSuccessStatusCode)
                            {
                                Console.Write("Success");
                            }
                            else
                            {
                                var errorMessage = response.Content.ReadAsStringAsync().Result;
                                Console.Write("Error");
                            }
                        }
                    }
                }


                //New commission details
                if (insertCommDetailList.Count > 0)
                {
                    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"));
                        var post = client.PostAsJsonAsync <List <commDetailListingData> >("api/CommGroupDtls", insertCommDetailList);
                        post.Wait();
                        var response = post.Result;
                        System.Net.ServicePointManager.Expect100Continue = false;
                        if (response.IsSuccessStatusCode)
                        {
                            ControlNosUpdate c = new ControlNosUpdate {
                                controldescription = "Comm Detail Code", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), controlnumber = Convert.ToString(controlNo)
                            };
                            string api = "api/ControlNos/updatecontrol";
                            post = client.PostAsJsonAsync <ControlNosUpdate>(api, c);
                            post.Wait();
                            response = post.Result;
                            if (response.IsSuccessStatusCode)
                            {
                                Console.Write("Success");
                            }
                        }
                        else
                        {
                            var errorMessage = response.Content.ReadAsStringAsync().Result;
                            Console.Write("Error");
                        }
                    }
                }
            }
        }