protected void txtcustomer_TextChanged(object sender, EventArgs e) { CustCode = txtcustomer.Text.ToString().Split(':')[0].Trim(); DataTable dt = new DataTable(); dt = DCMaster.Get_Name(CustCode, "Customer").Tables[0]; if (dt.Rows.Count != 0) { txtcustomer.Text = CustCode; lblCustName.Text = Convert.ToString(dt.Rows[0]["CustName"]); DataSet ds = booktype_Custmer_discount_Mapping.Get_AddDiscount_On_Cusomer(CustCode); if (ds.Tables[0].Rows.Count > 0) { txtAdiscount.Text = Convert.ToString(ds.Tables[0].Rows[0][0].ToString()); } // pnlDisountDetails.Visible = true; GrdViewCustDisDetails.DataSource = booktype_Custmer_discount_Mapping.Get_CustomerDiscountBy_BookType(txtcustomer.Text.ToString()); GrdViewCustDisDetails.DataBind(); // ds.Tables[0].Rows[0][0] btn_Save.Visible = true; UpanelGrd.Update(); upSAve.Update(); } else { lblCustName.Text = "No such Customer code"; txtcustomer.Focus(); txtcustomer.Text = ""; } }
protected void txtcustomer_TextChanged(object sender, EventArgs e) { CustCode = txtcustomer.Text.ToString().Split(':')[0].Trim(); DataTable dt = new DataTable(); dt = DCMaster.Get_Name(CustCode, "Customer").Tables[0]; if (dt.Rows.Count != 0) { txtcustomer.Text = CustCode; lblCustName.Text = Convert.ToString(dt.Rows[0]["CustName"]); DataSet ds = booktype_Custmer_discount_Mapping.Get_AddDiscount_On_Cusomer(CustCode); if (ds.Tables[0].Rows.Count > 0) { txtAdiscount.Text = Convert.ToString(ds.Tables[0].Rows[0][0].ToString()); } // pnlDisountDetails.Visible = true; GrdViewCustDisDetails.DataSource = booktype_Custmer_discount_Mapping.Get_CustomerDiscountBy_BookType(txtcustomer.Text.ToString() + "!" + Session["FY"].ToString()); GrdViewCustDisDetails.DataBind(); BindgrdTransportDetails(); // ds.Tables[0].Rows[0][0] btn_Save.Visible = true; DataSet dsTransport = new DataSet(); dsTransport = Idv.Chetana.BAL.CustomerToTransport.Get_CustomerandTransporterValueAD(CustCode); if (dsTransport.Tables[0].Rows.Count != 0) { pnlGet_TransDetails.Visible = true; grdget.DataSource = dsTransport.Tables[0]; grdget.DataBind(); grdget.Visible = true; } else { grdget.Visible = false; // MessageBox("No Such Record Found"); } UpanelGrd.Update(); upSAve.Update(); } else { lblCustName.Text = "No such Customer code"; txtcustomer.Focus(); txtcustomer.Text = ""; } }
void ClearControls() { foreach (GridViewRow row in GrdViewCustDisDetails.Rows) { ((TextBox)row.FindControl("lblDiscount")).Text = "0.00"; } //DDlTransport.SelectedValue = null; DDlTransport.SelectedIndex = 0; grdget.DataSource = null; grdget.Visible = false; txtcustomer.Text = ""; lblCustName.Text = ""; UpanelGrd.Update(); UpdatePanel5.Update(); uptdetail.Update(); }
protected void btn_Save_Click(object sender, EventArgs e) { try { foreach (GridViewRow row in GrdViewCustDisDetails.Rows) { booktype_Custmer_discount_Mapping _objCustDiscount = new booktype_Custmer_discount_Mapping(); if (lblID.Text == "0") { _objCustDiscount.Custcode = Convert.ToString(txtcustomer.Text.Trim() + "!" + Session["FY"].ToString()); } else { _objCustDiscount.Custcode = Convert.ToString(txtcustomer.Text.Trim() + "!" + Session["FY"].ToString()); } _objCustDiscount.BKTYPCustDisID = Convert.ToInt32(((Label)row.FindControl("lblBKTYPCustDisID")).Text.Trim()); _objCustDiscount.BookType = Convert.ToInt32(((Label)row.FindControl("lblBookTypeCode")).Text.Trim()); _objCustDiscount.Discount = Convert.ToDecimal(((TextBox)row.FindControl("lblDiscount")).Text.Trim()); _objCustDiscount.AdditionalDiscount = Convert.ToDecimal(((Label)row.FindControl("lblAdDiscount")).Text.Trim()); _objCustDiscount.IsActive = ((CheckBox)row.FindControl("chkisActive")).Checked; _objCustDiscount.Save(); } if (DDlTransport.SelectedValue.ToString() != "") { CustomerTransportSave(); } ClearControls(); UpanelGrd.Update(); MessageBox("Record saved successfully"); } catch { } }