Exemplo n.º 1
0
        private void SaveData(string NVOCCId)
        {
            BLL.DBInteraction dbinteract = new BLL.DBInteraction();
            bool isedit = NVOCCId != "-1" ? true : false;


            if (!isedit)
            {
                if (!dbinteract.IsUnique("mstNVOCC", "NVOCCName", txtLineName.Text.Trim()))
                {
                    GeneralFunctions.RegisterAlertScript(this, "Line Name must be unique. The given name has already been used for another Line. Please try with another one.");
                    return;
                }
            }

            if (fuLogo.HasFile)
            {
                hdnLogo.Value = "~/MasterModule/Image/" + fuLogo.GetImageFileName();
                fuLogo.PostedFile.SaveAs(Server.MapPath(hdnLogo.Value));
            }
            else
            {
                hdnLogo.Value = "";
            }
            decimal impComm = 0; decimal rBuffer = 0;

            decimal.TryParse(txtImpCommsn.Text, out impComm);
            decimal.TryParse(txtRBuffer.Text, out rBuffer);
            decimal expCommsn = 0;

            decimal.TryParse(txtExportCommission.Text, out expCommsn);
            char ExpBook = ddlExpBook.SelectedValue == "y"?'1':'0';
            int  result  = dbinteract.AddEditLine(_userId, Convert.ToInt32(NVOCCId), txtLineName.Text.Trim(), string.IsNullOrEmpty(txtFreeDays.Text) ? -1 :  Convert.ToInt32(txtFreeDays.Text), txtContact.Text, impComm, expCommsn, ExpBook, rBuffer, hdnLogo.Value, isedit);


            if (result > 0)
            {
                Response.Redirect("~/MasterModule/ManageLine.aspx");
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, "Error Occured");
            }
        }