Ejemplo n.º 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        objpl                      = new PL_ClientProfile();
        objpl.Ind                  = 1;
        objpl.StateCode            = int.Parse(ddlState.SelectedValue.ToString());
        objpl.DistrictCode         = 0;
        objpl.CityCode             = int.Parse(ddlCity.SelectedIndex < 0 ? "0" : ddlCity.SelectedValue.ToString());
        objpl.ClientType           = 0;
        objpl.FirmName             = txtOrganisationName.Text;
        objpl.ClientNameE          = txtName.Text;
        objpl.ClientNameH          = txtName.Text;
        objpl.ClientDesg           = txtDesignation.Text;
        objpl.ClientMobileNo1      = txtMobileNo.Text;
        objpl.ClientMobileNo2      = txtAlternateMobile.Text;
        objpl.LandLineNo           = txtLandLineNo.Text;
        objpl.EmailId              = txtEmailId.Text;
        objpl.ClientPANNo          = txtPanNo.Text.ToUpper();
        objpl.AadhaarNo            = txtAadhaarNo.Text;
        objpl.AlternateContactName = txtAlternatePerson.Text;
        objpl.AlternateMobileNo    = txtAlternateMobile.Text;
        objpl.AlternateEmailid     = txtEmailId.Text;
        objpl.BankName             = txtBankName.Text;
        objpl.BranchName           = txtBranchName.Text;
        objpl.IFSCCode             = IFSCCode.Text.ToUpper();
        objpl.AccountNo            = txtAccountNo.Text;
        objpl.DependentInd         = 1;
        objpl.CACode               = int.Parse(Session["CACode"].ToString());
        objpl.CACodeOdp            = 0;
        objpl.ActiveInd            = 1;
        objpl.LoginUserCode        = 0;
        objpl.RefnoOtherSys        = 0;
        objpl.BussinessTypeId      = int.Parse(ddlBussinessType.SelectedValue.ToString());
        objpl.BussinessNatureId    = int.Parse(ddlBussinessNature.SelectedValue.ToString());
        objpl.FullAddress          = txtFullAddress.Text;
        objpl.PinCode              = txtPinCode.Text;
        objpl.RegNo                = 0;//int.Parse(Session["RegNo"].ToString());
        objpl.GSTINNo              = txtGSTINNo.Text.ToUpper();
        DataTable dt = CLSCommon.CallApiPost("api/ClientProfile/SaveClientData/", objpl);

        if (dt.Rows.Count > 0)
        {
            pnlError.Visible    = true;
            Session["ErrorMsg"] = dt.Rows[0]["ErrorMsg"].ToString();
            Response.Redirect("frmSubmitted.aspx");
            lblMsg.Text = "Record Saved Successfully. Client Code : " + dt.Rows[0]["ClientCode"].ToString();
            clear();
        }
    }
    protected void Unnamed_Click(object sender, EventArgs e)
    {
        if (ViewState["GSTINTable"] == null)
        {
            lbl.Text = "Add Atleast One GSTIN";
            txtGSTINNO.Focus();
            return;
        }
        else
        {
            DataTable dtGSTN = (DataTable)ViewState["GSTINTable"];
            if (dtGSTN.Rows.Count == 0)
            {
                lbl.Text = "Add Atleast One GSTIN";
                txtGSTINNO.Focus();
                return;
            }
            else
            {
                objpl                      = new PL_ClientProfile();
                objpl.Ind                  = 1;
                objpl.StateCode            = int.Parse(ddlState.SelectedValue.ToString());
                objpl.DistrictCode         = 0;
                objpl.CityCode             = int.Parse(ddlCity.SelectedIndex < 0 ? "0" : ddlCity.SelectedValue.ToString());
                objpl.ClientType           = 0;
                objpl.FirmName             = txtOrganisationName.Text;
                objpl.ClientNameE          = txtName.Text;
                objpl.ClientNameH          = txtName.Text;
                objpl.ClientDesg           = txtDesignation.Text;
                objpl.ClientMobileNo1      = txtMobileNo.Text;
                objpl.ClientMobileNo2      = txtAlternateMobile.Text;
                objpl.EmailId              = txtEmailId.Text;
                objpl.ClientPANNo          = txtPanNo.Text.ToUpper();
                objpl.AadhaarNo            = txtAadhaarNo.Text;
                objpl.AlternateContactName = txtAlternatePerson.Text;
                objpl.AlternateMobileNo    = txtAlternateMobile.Text;
                objpl.AlternateEmailid     = txtEmailId.Text;
                objpl.DependentInd         = 1;
                objpl.CACode               = int.Parse(Session["CACode"].ToString());
                objpl.CACodeOdp            = 0;
                objpl.ActiveInd            = 1;
                objpl.LoginUserCode        = 0;
                objpl.RefnoOtherSys        = 0;
                objpl.FullAddress          = txtFullAddress.Text;
                objpl.PinCode              = txtPinCode.Text;
                objpl.RegNo                = 0;
                objpl.AggrTurnOver         = txtAggrTurnOver.Text.Trim() == "" ? "0" : txtAggrTurnOver.Text.Trim();
                objpl.AggrTurnOverAprJun   = txtAggrTurnOverAprJun.Text.Trim() == "" ? "0" : txtAggrTurnOverAprJun.Text.Trim();
                objpl.CompAppInd           = coyes.Checked ? 1 : 2;
                objpl.CompAppDate          = coyes.Checked ? CLSCommon.DateFormat(txtCoDate.Text) : "";
                objpl.NonResiTaxInd        = rpyes.Checked ? 1 : 2;
                objpl.NonResFromDate       = rpyes.Checked ? CLSCommon.DateFormat(txtResDateFrom.Text) : "";
                objpl.NonResToDate         = rpyes.Checked ? CLSCommon.DateFormat(txtResDateTo.Text) : "";

                DataTable dt = CLSCommon.CallApiPost("api/ClientProfile/SaveClientData/", objpl);
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        if (dt.Rows[0]["res"].ToString() == "1")
                        {
                            Session["ErrorMsg"] = dt.Rows[0]["ErrorMsg"].ToString();
                            int ClientCode    = int.Parse(dt.Rows[0]["ClientCode"].ToString());
                            int ClientCodeOdp = int.Parse(dt.Rows[0]["ClientCodeOdp"].ToString());

                            foreach (DataRow dr in dtGSTN.Rows)
                            {
                                PL_InsertClientGSTIN objplInsertGSTIN = new PL_InsertClientGSTIN();
                                objplInsertGSTIN.Ind                      = 1;
                                objplInsertGSTIN.ClientCode               = ClientCode;
                                objplInsertGSTIN.ClientCodeOdp            = ClientCodeOdp;
                                objplInsertGSTIN.OdpGSTNo                 = 0;
                                objplInsertGSTIN.GSTNNO                   = dr["GSTNNO"].ToString();
                                objplInsertGSTIN.PANNO                    = txtPanNo.Text;
                                objplInsertGSTIN.TradeName                = dr["TradeName"].ToString();
                                objplInsertGSTIN.DateOfReg                = dr["DateOfReg"].ToString() == "" ? "" : CLSCommon.DateFormat(dr["DateOfReg"].ToString());
                                objplInsertGSTIN.ContactAddress           = dr["ContactAddress"].ToString();
                                objplInsertGSTIN.StateCode                = dr["StateCode"].ToString();
                                objplInsertGSTIN.ContactStateCode         = int.Parse(dr["StateCode"].ToString());
                                objplInsertGSTIN.ContactCityCode          = int.Parse(dr["CityCode"].ToString());
                                objplInsertGSTIN.AuthorisedSignetory      = dr["AuthorisedSignetory"].ToString();
                                objplInsertGSTIN.ClientUserID             = dr["GSTUserName"].ToString();
                                objplInsertGSTIN.Designation              = dr["Designation"].ToString();
                                objplInsertGSTIN.ContactMobileNo          = dr["ContactMobileNo"].ToString();
                                objplInsertGSTIN.ContactEmailid           = dr["ContactEmailid"].ToString();
                                objplInsertGSTIN.AadhaarNo                = dr["AadhaarNo"].ToString();
                                objplInsertGSTIN.RegisteredAsISD          = int.Parse(dr["ISD"].ToString());
                                objplInsertGSTIN.RegisteredAsTDS          = int.Parse(dr["TDS"].ToString());
                                objplInsertGSTIN.WhetherEcommerceOperator = int.Parse(dr["TCS"].ToString());
                                objplInsertGSTIN.Priority                 = 1;
                                objplInsertGSTIN.ContactPersonName        = txtName.Text; // dr["TradeName"].ToString();
                                objplInsertGSTIN.ActiveInd                = 1;
                                objplInsertGSTIN.Allotmentind             = 0;
                                objplInsertGSTIN.AllotmentCACode          = int.Parse(Session["CaCode"].ToString());
                                objplInsertGSTIN.AllotmentCACodeOdp       = int.Parse(Session["CaCodeOdp"].ToString());
                                objplInsertGSTIN.CompositeInd             = coyes.Checked ? 1 : 2;
                                objplInsertGSTIN.NRIInd                   = rpyes.Checked ? 1 : 2;
                                DataTable dtRes = CLSCommon.CallApiPost("api/ClientProfile/SaveClientGSTIN/", objplInsertGSTIN);
                            }
                            clear();
                            Response.Redirect("frmSubmitted.aspx");
                        }
                        else
                        {
                            lblErrorMsg.Text = dt.Rows[0]["Message"].ToString();
                        }
                    }
                }
            }
        }
    }