예제 #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtLcNo.Text == "")
            {
                // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Create LC No. first!')", true);
                //return;
            }
            try
            {
                if (ddlSubCompany.SelectedItem.Text != "---Select One---")
                {
                    LC_MasterLC _objLCmaster = new LC_MasterLC();
                    _objLCmaster.SubCompany_Id  = Convert.ToInt32(ddlSubCompany.SelectedValue);
                    _objLCmaster.SubCompanyName = ddlSubCompany.SelectedItem.Text;
                    _objLCmaster.LCNo           = txtLcNo.Text;
                    Session["LCNo"]             = txtLcNo.Text;
                    _objLCmaster.DateofIssue    = Convert.ToDateTime(txtDateofIssue.Text);
                    _objLCmaster.DateofExpiry   = Convert.ToDateTime(txtDateofExpiry.Text);
                    _objLCmaster.BuyerType      = ddlBuyerType.SelectedValue.ToString();
                    _objLCmaster.Buyer_ID       = Convert.ToInt16(ddlBuyerName.SelectedValue);
                    _objLCmaster.Season         = txtSeason.Text;
                    _objLCmaster.Qty            = Convert.ToDouble(txtQty.Text);
                    //_objLCmaster.ItemDescription = txtItemDescription.Text;
                    _objLCmaster.USDRate       = 0; //Convert.ToDecimal(txtUSD.Text);
                    _objLCmaster.BDTRate       = 0; // Convert.ToDecimal(txtBDT.Text);
                    _objLCmaster.LC_USDValu    = Convert.ToDouble(txtUSDV.Text);
                    _objLCmaster.Conv_Rate     = Convert.ToDecimal(txtConvRate.Text);
                    _objLCmaster.LC_BDTValu    = Convert.ToDouble(txtBDTV.Text);
                    _objLCmaster.Create_User   = ((SessionUser)Session["SessionUser"]).UserId;
                    _objLCmaster.LC_Issue_Bank = txtIssueBank.Text;
                    _objLCmaster.Create_Date   = DateTime.Now;
                    _objLCmaster.LCType        = "Contact";

                    _objLCmaster.OCODE = ((SessionUser)Session["SessionUser"]).OCode;
                    if (btnSubmit.Text == "Submit")
                    {
                        int result = _masterlcBLL.InsertLCmaster(_objLCmaster);

                        if (result == 1)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true);
                        }
                    }
                    else
                    {
                        _objLCmaster.Edit_User = ((SessionUser)Session["SessionUser"]).UserId;
                        _objLCmaster.Edit_Date = DateTime.Now;
                        int results = _masterlcBLL.UpdateMasterLc(txtLcNo.Text, _objLCmaster);

                        if (results == 1)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true);
                            btnSubmit.Text = "Submit";
                        }
                    }
                    ClearUI();
                    ShowMasterLC();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select SubCompany!')", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }