protected void Operation_Click(object sender, EventArgs e) { try { if (Validation()) { if (btn_AddPaymentType.InnerText.Trim() == "Add") { using (var client = new HttpClient()) { PaymentTypeList p = new PaymentTypeList { payCode = txt_PayCode.Value.ToString().Trim(), payDescription = txt_PayDesc.Value.ToString().Trim(), sequence = txt_Sequence.Value.ToString().Trim(), payGroup = ddlPayGroup.Value.ToString().Trim(), payIsactive = chkActive.Checked, payIsGst = chkGstActive.Checked, iscreditcard = chkCreditCardActive.Checked, isonlinepayment = chkOnlinePaymentActive.Checked, gtGroup = "0", rwUsebp = true, iscomm = false, bankCharges = "0", eps = "0", voucherPaymentControl = false, showInReport = false, creditcardcharges = txt_CreditCharges.Value.ToString().Trim(), onlinepaymentcharges = txt_OnlinePayCharges.Value.ToString().Trim(), accountCode = txt_AccountCode.Value.ToString().Trim(), accountMapping = false, openCashdrawer = false, iscustapptpromo = false, isvoucherExtvoucher = false, }; 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 <PaymentTypeList>("api/Paytables", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { oCommonEngine.SetAlert(this.Page, "Payment Type Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); // Response.Redirect("ConfigInterface_PaymentType.aspx"); Get_PaymentType(); } else { oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } } } else { using (var client = new HttpClient()) { PaymentTypeListUpdate p = new PaymentTypeListUpdate { //payId = Int32.Parse(_PKey), payId = int.Parse(Session["id"].ToString()), payCode = txt_PayCode.Value.ToString().Trim(), payDescription = txt_PayDesc.Value.ToString().Trim(), sequence = txt_Sequence.Value.ToString().Trim(), payGroup = ddlPayGroup.Value.ToString().Trim(), payIsactive = chkActive.Checked, payIsGst = chkGstActive.Checked, iscreditcard = chkCreditCardActive.Checked, isonlinepayment = chkOnlinePaymentActive.Checked, gtGroup = "0", rwUsebp = true, iscomm = false, bankCharges = "0", eps = "0", voucherPaymentControl = false, showInReport = false, creditcardcharges = txt_CreditCharges.Value.ToString().Trim(), onlinepaymentcharges = txt_OnlinePayCharges.Value.ToString().Trim(), accountCode = txt_AccountCode.Value.ToString().Trim(), accountMapping = false, openCashdrawer = false, iscustapptpromo = false, isvoucherExtvoucher = false, }; 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 <PaymentTypeListUpdate>("api/Paytables", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { oCommonEngine.SetAlert(this.Page, "Payment Type Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); Get_PaymentType(); } else { oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } } // Response.Redirect("ConfigInterface_PaymentType.aspx"); } 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 { if (Validation()) { if (btn_AddPaymentType.InnerText.Trim() == "Add") { if (tblPaymentTypeList.Rows.Count > 0) { //for (int i = 0; i < tblPaymentTypeList.Rows.Count; i++) //{ // if (Convert.ToString(tblPaymentTypeList.Rows[i][]) == txt_PayCode.Value.ToString().Trim()) // { // } //} //var customers = from customer in tblPaymentTypeList.AsEnumerable() // where customer.Field<string>("Country") == country // select new // { // CustomerId = customer.Field<int>("CustomerId"), // Name = customer.Field<string>("Name"), // Country = customer.Field<string>("Country") // }; } using (var client = new HttpClient()) { PaymentTypeList p = new PaymentTypeList { payCode = txt_PayCode.Value.ToString().Trim(), payDescription = txt_PayDesc.Value.ToString().Trim(), sequence = txt_Sequence.Value.ToString().Trim(), payGroup = ddlPayGroup.Value.ToString().Trim(), payIsactive = chkActive.Checked, payIsGst = chkGstActive.Checked, iscreditcard = chkCreditCardActive.Checked, isonlinepayment = chkOnlinePaymentActive.Checked, gtGroup = ddlGtGroup.Value.ToString().Trim(), //"GT1", rwUsebp = true, iscomm = false, bankCharges = txt_BankCharges.Value.ToString().Trim(), eps = "0", voucherPaymentControl = false, showInReport = false, creditcardcharges = txt_CreditCharges.Value.ToString().Trim(), onlinepaymentcharges = txt_OnlinePayCharges.Value.ToString().Trim(), accountCode = txt_AccountCode.Value.ToString().Trim(), accountMapping = false, openCashdrawer = false, iscustapptpromo = false, isvoucherExtvoucher = false, }; 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 <PaymentTypeList>("api/Paytables", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { oCommonEngine.SetAlert(this.Page, "Payment Type Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); // Response.Redirect("ConfigInterface_PaymentType.aspx"); Get_PaymentType(); } else { //oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); //ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Something Wrong.. Please Check Payment Type or Descripton for Duplicate!');", true); ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage();", true); return; } } } else { using (var client = new HttpClient()) { PaymentTypeListUpdate p = new PaymentTypeListUpdate { //payId = Int32.Parse(_PKey), payId = int.Parse(Session["id"].ToString()), payCode = txt_PayCode.Value.ToString().Trim(), payDescription = txt_PayDesc.Value.ToString().Trim(), sequence = txt_Sequence.Value.ToString().Trim(), payGroup = ddlPayGroup.Value.ToString().Trim(), payIsactive = chkActive.Checked, payIsGst = chkGstActive.Checked, iscreditcard = chkCreditCardActive.Checked, isonlinepayment = chkOnlinePaymentActive.Checked, gtGroup = ddlGtGroup.Value.ToString().Trim(), // "GT1", rwUsebp = true, iscomm = false, bankCharges = txt_BankCharges.Value.ToString().Trim(), eps = "0", voucherPaymentControl = false, showInReport = false, creditcardcharges = txt_CreditCharges.Value.ToString().Trim(), onlinepaymentcharges = txt_OnlinePayCharges.Value.ToString().Trim(), accountCode = txt_AccountCode.Value.ToString().Trim(), accountMapping = false, openCashdrawer = false, iscustapptpromo = false, isvoucherExtvoucher = false, }; 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 <PaymentTypeListUpdate>("api/Paytables", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { oCommonEngine.SetAlert(this.Page, "Payment Type Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); Get_PaymentType(); } else { //oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); //ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Something Wrong.. Please Check Payment Type or Descripton for Duplicate!');", true); ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage();", true); return; } } // Response.Redirect("ConfigInterface_PaymentType.aspx"); } DataClear(); } } catch (Exception Ex) { oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } }