private void UpdateRecord(int TrId, string agentId, double agencysales, double paymentsales, string DdId) { int result = 0; CashierData cashierdata = new CashierData(); result = cashierdata.AddAgentCashSales(TrId, agentId, agencysales, paymentsales, DdId); if (result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Payment Details Update Successfully"; pnlError.Update(); upModal.Update(); UpdatePanel1.Update(); uprouteList.Update(); Session["flag"] = "No"; } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); Session["flag"] = "No"; } }
public async Task <IActionResult> Deletebill([FromBody] JObject bills) { CashierData bill = _context.cashierDatas.Where(o => o.ID == Convert.ToInt32(bills["billID"].ToString())).FirstOrDefault(); if (bill == null) { return(BadRequest()); } _context.cashierDatas.Remove(bill); await _context.SaveChangesAsync(); return(Ok()); }
protected void btnUpdate_Click(object sender, EventArgs e) { //string confirmValue = Request.Form["confirm_value"]; string totalamt = lbltotalamt.Text.ToString(); double temp = string.IsNullOrEmpty(txttotalPay.Text) ? 0 : Convert.ToDouble(txttotalPay.Text); string totalpayamt = txttotalPay.Text.ToString(); string hftemp = Session["flag"].ToString();; if (temp > 0 && (hftemp == "Yes" || hftemp == "YesExcess" || hftemp == "YesPending")) { CashierData cd = new CashierData(); Model.Cashier cm = new Model.Cashier(); cm.DispatchDate = Convert.ToDateTime(txtOrderDate.Text).ToString("dd-MM-yyyy"); cm.Salesmanid = Convert.ToInt32(dpSalesman.SelectedItem.Value); cm.BrandId = Convert.ToInt32(dpBrand.SelectedItem.Value); cm.trDate = DateTime.Now.ToString("dd-MM-yyyy"); cm.netamt = string.IsNullOrEmpty(txtNetAmt.Text) ? 0 : Convert.ToDouble(txtNetAmt.Text); cm.payamt = string.IsNullOrEmpty(txttotalPay.Text) ? 0 : Convert.ToDouble(txttotalPay.Text); cm.P2000 = string.IsNullOrEmpty(txt2000.Text) ? 0 : Convert.ToInt32(txt2000.Text); cm.P1000 = string.IsNullOrEmpty(txt1000.Text) ? 0 : Convert.ToInt32(txt1000.Text); cm.P500 = string.IsNullOrEmpty(txt500.Text) ? 0 : Convert.ToInt32(txt500.Text); cm.P100 = string.IsNullOrEmpty(txt100.Text) ? 0 : Convert.ToInt32(txt100.Text); cm.P50 = string.IsNullOrEmpty(txt50.Text) ? 0 : Convert.ToInt32(txt50.Text); cm.P20 = string.IsNullOrEmpty(txt20.Text) ? 0 : Convert.ToInt32(txt20.Text); cm.P10 = string.IsNullOrEmpty(txt10.Text) ? 0 : Convert.ToInt32(txt10.Text); cm.P5 = string.IsNullOrEmpty(txt5.Text) ? 0 : Convert.ToInt32(txt5.Text); cm.P2 = string.IsNullOrEmpty(txt2.Text) ? 0 : Convert.ToInt32(txt2.Text); cm.rscoins = string.IsNullOrEmpty(txtCoin.Text) ? 0 : Convert.ToDouble(txtCoin.Text); cm.TokanId = hftokanno.Value; cm.createdby = GlobalInfo.Userid; cm.RouteID = Convert.ToInt32(dpRoute.SelectedItem.Value); cm.flag = "insert"; DataSet DS = new DataSet(); DS = cd.AddCashierInfo(cm); if (hftemp == "YesPending") { Session["flag"] = "No"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "one", "alert('salesman payment update successfully')", true); } if (hftemp == "YesExcess") { Session["flag"] = "No"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "two", "alert('salesman has already paid excess amount!')", true); } if (DS.Tables[0].Rows.Count != 0) { foreach (RepeaterItem item in rpRouteList.Items) { TextBox txtagencysalesamt = item.FindControl("txtAgencySales") as TextBox; TextBox txtpaymentamt = item.FindControl("txtPayment") as TextBox; HiddenField hdfID = item.FindControl("hfAgentId") as HiddenField; HiddenField hfDDId = item.FindControl("hfDDId") as HiddenField; int TrId; TrId = Convert.ToInt32(DS.Tables[0].Rows[0]["TrId"]); if (hdfID != null) { double agencysales; try { agencysales = Convert.ToDouble(txtagencysalesamt.Text); } catch { agencysales = 0.00; } string agentId = hdfID.Value; string DispatchDetailsId = string.IsNullOrEmpty(hfDDId.Value) ? "0" : hfDDId.Value; double paymentsales; try { paymentsales = Convert.ToDouble(txtpaymentamt.Text); } catch { paymentsales = 0.00; } UpdateRecord(TrId, agentId, agencysales, paymentsales, DispatchDetailsId); } } } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true); upModal.Update(); // //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked NO!')", true); } }