Ejemplo n.º 1
0
    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
        {
        }
    }
Ejemplo n.º 2
0
    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());
                }
                else
                {
                    _objCustDiscount.Custcode = Convert.ToString(txtcustomer.Text.Trim());
                }
                _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();

                //lblID.Text = "0";
                //DDlBooktype.Text = "";
                //txtdiscount.Text = "";
                // pnlDisountDetails.Visible = true;
                //PnlCustDiscDetails.Visible = false;
            }

            MessageBox("Record saved successfully");
        }
        catch
        {
        }
    }