コード例 #1
0
    private void DisplayDetails()
    {
        AuctionItem auctionItem = AuctionItemTransaction.QueryAuctionItemInfo(ViewState[Constant.SESSION_AUCTIONREFNO].ToString().Trim());

        CategoryTransaction     category = new CategoryTransaction();
        GroupDeptSecTransaction grp      = new GroupDeptSecTransaction();
        CompanyTransaction      cmp      = new CompanyTransaction();

        OtherTransaction dte = new OtherTransaction();

        lblCompany.Text = cmp.GetCompanyName(connstring, auctionItem.CompanyId.ToString().Trim());

        lblRequestor.Text = auctionItem.Requestor.ToString().Trim();
        lblPRNumber.Text  = auctionItem.PRRefNo.ToString().Trim();
        lblPRDate.Text    = auctionItem.PRDate.ToString().Trim();
        lblGroup.Text     = grp.GetGroupDeptSecNameById(connstring, auctionItem.GroupDeptSec.ToString().Trim());
        lblAuctionReferenceNumber.Text = auctionItem.AuctionRefNo.ToString().Trim();
        lblSubCategory.Text            = category.GetCategoryNameById(connstring, auctionItem.Category.ToString().Trim());
        // lblDeadline.Text = auctionItem.Deadline.ToString().Trim();
        lblDeliveryDate.Text = auctionItem.DeliveryDate.ToString().Trim();
        lblItemDesc.Text     = auctionItem.ItemDescription.ToString().Trim();

        lblAuctionType.Text      = AuctionItemTransaction.GetAuctionTypeById(auctionItem.AuctionType.ToString().Trim());
        lblAuctionDeadline.Text  = auctionItem.AuctionDeadline.ToString().Trim();
        lblAuctionDate.Text      = auctionItem.AuctionStartDate.ToString().Trim();
        lblAuctionStartTime.Text = auctionItem.AuctionStartTime.ToString().Trim();
        lblAuctionEndTime.Text   = auctionItem.AuctionEndTime.ToString().Trim();
        lblBidCurrency.Text      = AuctionItemTransaction.getBidCurrency(auctionItem.BidCurrency.ToString().Trim());
    }
コード例 #2
0
    private void displayDetails()
    {
        if (ViewState[Constant.SESSION_BIDREFNO] != null)
        {
            BidItem                 biditem  = BidItemTransaction.QueryBidItemInfo(connstring, ViewState[Constant.SESSION_BIDREFNO].ToString().Trim());
            CategoryTransaction     category = new CategoryTransaction();
            GroupDeptSecTransaction grp      = new GroupDeptSecTransaction();
            CompanyTransaction      cmp      = new CompanyTransaction();
            IncotermTransaction     inc      = new IncotermTransaction();
            OtherTransaction        dte      = new OtherTransaction();

            lblCompany.Text = cmp.GetCompanyName(connstring, biditem.CompanyId.ToString().Trim());

            lblRequestor.Text             = biditem.Requestor.ToString().Trim();
            lblPRNumber.Text              = biditem.PRRefNo.ToString().Trim();
            lblPRDate.Text                = biditem.PRDate.ToString().Trim();
            lblGroup.Text                 = grp.GetGroupDeptSecNameById(connstring, biditem.GroupDeptSec.ToString().Trim());
            lblBidReferenceNumber.Text    = biditem.BidRefNo.ToString().Trim();
            lblSubCategory.Text           = category.GetCategoryNameById(connstring, biditem.Category.ToString().Trim());
            lblBidSubmissionDeadline.Text = biditem.Deadline.ToString().Trim();
            lblBidItemDescription.Text    = biditem.ItemDescription;
            lblDeliverTo.Text             = biditem.DeliverTo;
            lblIncoterm.Text              = inc.GetIncotermName(connstring, biditem.Incoterm);

            hdBidEventType.Value = biditem.BidStatus.ToString().Trim();

            displayItemDetails();
            displaySuppliers();
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
        connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
        if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER)
        {
            Response.Redirect("../unauthorizedaccess.aspx");
        }

        if (!(IsPostBack))
        {
            Session[Constant.SESSION_COMMENT_TYPE] = "1";
            if (Request.QueryString["AuctionRefNo"] != null)
            {
                Session["AuctionRefNo"] = Request.QueryString["AuctionRefNo"].ToString().Trim();
            }

            if (Session["AuctionRefNo"] != null)
            {
                hdnAuctionRefNo.Value = Session["AuctionRefNo"].ToString().Trim();
            }

            if (hdnAuctionRefNo.Value.Trim() != "")
            {
                AuctionTransaction      au  = new AuctionTransaction();
                AuctionItem             ai  = au.GetAuctionByAuctionRefNo(connstring, hdnAuctionRefNo.Value.Trim());
                CompanyTransaction      cmp = new CompanyTransaction();
                GroupDeptSecTransaction grp = new GroupDeptSecTransaction();
                CategoryTransaction     cat = new CategoryTransaction();
                OtherTransaction        oth = new OtherTransaction();
                lblCompany.Text         = cmp.GetCompanyName(connstring, ai.CompanyId.ToString().Trim());
                lblRequestor.Text       = ai.Requestor.ToString().Trim();
                lblPRNumber.Text        = ai.PRRefNo.ToString().Trim();
                lblPRDate.Text          = ai.PRDate.ToString().Trim();
                lblGroup.Text           = grp.GetGroupDeptSecNameById(connstring, ai.GroupDeptSec.ToString().Trim());
                lblSubCategory.Text     = cat.GetCategoryNameById(connstring, ai.Category.ToString().Trim());
                lblDeadline.Text        = ai.AuctionDeadline.ToString().Trim();
                lblDeliveryDate.Text    = ai.DeliveryDate.ToString().Trim();
                lblItemDescription.Text = ai.ItemDescription.ToString().Trim();
                lblReferenceNumber.Text = hdnAuctionRefNo.Value.Trim();

                lblAuctionType.Text = au.GetAuctionTypeNameById(connstring, ai.AuctionType.ToString().Trim());
                lblAuctionConfirmationDeadline.Text = ai.AuctionDeadline.ToString().Trim();
                lblAuctionEventDate.Text            = ai.AuctionStartDate.ToString().Trim();
                lblAuctionStartTime.Text            = ai.AuctionStartTimeHour.ToString().Trim() + ":" +
                                                      ai.AuctionStartTimeMin.ToString().Trim() + ":" +
                                                      ai.AuctionStartTimeSec.ToString().Trim() + " " +
                                                      ai.AuctionStartTimeAMPM.ToString().Trim();
                lblAuctionEndTime.Text = ai.AuctionEndTimeHour.ToString().Trim() + ":" +
                                         ai.AuctionEndTimeMin.ToString().Trim() + ":" +
                                         ai.AuctionEndTimeSec.ToString().Trim() + " " +
                                         ai.AuctionEndTimeAMPM.ToString().Trim();
                lblBidCurrency.Text = oth.GetBidCurrency(ai.BidCurrency.ToString().Trim());

                ShowSuppliers();
                ShowFiles(ai.FileAttachments.ToString().Trim());
                ShowAuctionItems();
            }
        }
    }
コード例 #4
0
    private void DisplayDetails()
    {
        BidItemDetailTransaction biddetail = new BidItemDetailTransaction();
        ArrayList        biddetailarray    = biddetail.GetBidDetails(connstring, Session[Constant.SESSION_BIDREFNO].ToString().Trim());
        OtherTransaction dte = new OtherTransaction();

        foreach (BidItemDetail b in biddetailarray)
        {
            HtmlTableRow    row  = new HtmlTableRow();
            HtmlTableCell[] cell = new HtmlTableCell[5];
            cell[0] = new HtmlTableCell();
            cell[0].Controls.Add(new LiteralControl(b.Item));
            row.Cells.Add(cell[0]);
            cell[1] = new HtmlTableCell();
            cell[1].Controls.Add(new LiteralControl(b.DetailDesc));
            cell[1].Attributes.Add("class", "value");
            row.Cells.Add(cell[1]);
            cell[2] = new HtmlTableCell();
            cell[2].Controls.Add(new LiteralControl(b.Qty.ToString().Trim()));
            cell[2].Attributes.Add("class", "value");
            row.Cells.Add(cell[2]);
            cell[3] = new HtmlTableCell();
            cell[3].Controls.Add(new LiteralControl(b.UnitOfMeasure.ToString().Trim()));
            cell[3].Attributes.Add("class", "value");
            row.Cells.Add(cell[3]);
            itemDetails1.Rows.Add(row);
        }
    }
コード例 #5
0
        private void FillDropDownList()
        {
            OtherTransaction oth = new OtherTransaction();

            ddlPreferredCurrency.DataSource     = oth.GetCurrency();
            ddlPreferredCurrency.DataValueField = "Value";
            ddlPreferredCurrency.DataTextField  = "Text";
            ddlPreferredCurrency.DataBind();
        }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
        connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
        if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER)
        {
            Response.Redirect("../unauthorizedaccess.aspx");
        }

        if (Request.QueryString["brn"] != null)
        {
            Session[Constant.SESSION_BIDREFNO] = Request.QueryString["brn"].ToString();
        }

        if (!(Page.IsPostBack))
        {
            if (Request.QueryString[Constant.SESSION_BIDREFNO] != null)
            {
                Session[Constant.SESSION_BIDREFNO] = Request.QueryString[Constant.SESSION_BIDREFNO].ToString().Trim();
            }

            if (Session["ORDERBY"] == null)
            {
                Session["ORDERBY"] = "DESC";
            }

            BidItem                 bid      = BidItemTransaction.QueryBidItemInfo(connstring, Session[Constant.SESSION_BIDREFNO].ToString());
            BuyerTransaction        buyer    = new BuyerTransaction();
            CategoryTransaction     category = new CategoryTransaction();
            GroupDeptSecTransaction grp      = new GroupDeptSecTransaction();
            CompanyTransaction      cmp      = new CompanyTransaction();
            VendorTransaction       vnd      = new VendorTransaction();
            IncotermTransaction     inc      = new IncotermTransaction();
            OtherTransaction        obj      = new OtherTransaction();

            lblBidReferenceNumber.Text = bid.BidRefNo.ToString().Trim();

            lblCompany.Text               = cmp.GetCompanyName(connstring, bid.CompanyId.ToString().Trim());
            lblRequestor.Text             = bid.Requestor.ToString().Trim();
            lblPRNumber.Text              = bid.PRRefNo.ToString().Trim();
            lblPRDate.Text                = bid.PRDate.ToString().Trim();
            lblGroup.Text                 = grp.GetGroupDeptSecNameById(connstring, bid.GroupDeptSec.ToString().Trim());
            lblBidRefNo.Text              = bid.BidRefNo.ToString().Trim();
            lblSubCategory.Text           = category.GetCategoryNameById(connstring, bid.Category.ToString().Trim());
            lblBidSubmissionDeadline.Text = bid.Deadline.ToString().Trim();
            lblBidItemDesc.Text           = bid.ItemDescription.ToString().Trim();
            lblDeliverTo.Text             = bid.DeliverTo.ToString().Trim();
            lblIncoterm.Text              = inc.GetIncotermName(connstring, bid.Incoterm.ToString().Trim());

            DisplayDetails();
            Bind();
        }
    }
コード例 #7
0
    protected void lnkOK_Click(object sender, EventArgs e)
    {
        SupplierTransaction supp = new SupplierTransaction();
        OtherTransaction    oth  = new OtherTransaction();

        if (!(supp.VendorExists(oth.Replace(txtVendorName.Text.Trim()))))
        {
            string vUserName = tbUserName.Text.Replace(" ", "");
            //if (vUserName.Length > 8)
            //    vUserName = vUserName.Substring(0, 8).ToUpper();
            //else
            //    vUserName = vUserName.ToUpper();

            if (supp.CheckUser(tbUserName.Text.Trim()))
            {
                string randomPwd = RandomPasswordGenerator.GenerateRandomPassword();

                int vVendorId = supp.InsertUser(connstring, vUserName, EncryptionHelper.Encrypt(randomPwd), ((int)Constant.USERTYPE.VENDOR).ToString().Trim());
                ViewState["sUserID"] = vVendorId;

                web_usercontrol_mobileno uctrlMobileNo1 = (web_usercontrol_mobileno)FindControl("uctrlMobileNo");

                supp.InsertOneTimeSupplier(vVendorId.ToString().Trim(), txtVendorName.Text.Trim(),
                                           ((int)Constant.SUPPLIERTYPE.OneTimeSupplier).ToString().Trim(),
                                           txtEmailAddress.Text.Trim(),
                                           txtAddress1.Text.Trim(),
                                           txtAddress2.Text.Trim(),
                                           txtContactPerson.Text.Trim(),
                                           txtTelephoneNumber.Text.Trim(), uctrlMobileNo1.MobileNumber);

                supp.SaveCategoriesAndSubCategories(vVendorId, ViewState[Constant.QS_CATEGORYID].ToString(), ViewState[Constant.QS_SUBCATEGORYID].ToString());

                string emailOk = "";
                if (SendEmail())
                {
                    emailOk = " and notified";
                }
                lblMessage.Text = txtVendorName.Text.Trim() + " has been successfully added" + emailOk + ".";
                lnkClose.Attributes.Add("onclick", "AddSuppliersB('" + vVendorId + "', '" + txtVendorName.Text.Trim() + "');");
                DisableFields();
            }
            else
            {
                lblMessage.Text = tbUserName.Text.Trim() + " already exists.";
            }
        }
        else
        {
            lblMessage.Text = txtVendorName.Text.Trim() + " already exists in the vendor list.";
        }
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
        connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
        if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER)
        {
            Response.Redirect("../unauthorizedaccess.aspx");
        }

        if (!(Page.IsPostBack))
        {
            Session[Constant.SESSION_COMMENT_TYPE] = "0";
            if (Request.QueryString["BidRefNo"] != null)
            {
                Session["BidRefNo"] = Request.QueryString["BidRefNo"].ToString().Trim();
            }

            BidItem                 bid      = BidItemTransaction.QueryBidItemInfo(connstring, Request.QueryString["BidRefNo"].ToString().Trim());
            BuyerTransaction        buyer    = new BuyerTransaction();
            CategoryTransaction     category = new CategoryTransaction();
            GroupDeptSecTransaction grp      = new GroupDeptSecTransaction();
            CompanyTransaction      cmp      = new CompanyTransaction();
            VendorTransaction       vnd      = new VendorTransaction();
            IncotermTransaction     inc      = new IncotermTransaction();
            OtherTransaction        obj      = new OtherTransaction();

            lblCompany.Text               = cmp.GetCompanyName(connstring, bid.CompanyId.ToString().Trim());
            lblRequestor.Text             = bid.Requestor.ToString().Trim();
            lblPRNumber.Text              = bid.PRRefNo.ToString().Trim();
            lblPRDate.Text                = bid.PRDate.ToString().Trim();
            lblGroup.Text                 = grp.GetGroupDeptSecNameById(connstring, bid.GroupDeptSec.ToString().Trim());
            lblBidRefNo.Text              = bid.BidRefNo.ToString().Trim();
            lblSubCategory.Text           = category.GetCategoryNameById(connstring, bid.Category.ToString().Trim());
            lblBidSubmissionDeadline.Text = bid.Deadline.ToString().Trim();
            lblBidItemDesc.Text           = bid.ItemDescription.ToString().Trim();
            lblDeliverTo.Text             = bid.DeliverTo.ToString().Trim();
            lblIncoterm.Text              = inc.GetIncotermName(connstring, bid.Incoterm.ToString().Trim());

            DataTable dtSuppliers = BidItemTransaction.GetSuppliers(connstring, Session["BidRefNo"].ToString().Trim());
            gvSuppliers.DataSource = dtSuppliers;
            gvSuppliers.DataBind();

            DataTable  dtFileAttachment = new DataTable();
            DataColumn dcol1            = new DataColumn("FILES", typeof(System.String));
            dtFileAttachment.Columns.Add(dcol1);

            string   Files  = bid.FileAttachments;
            string[] Files1 = Files.Split(Convert.ToChar("|"));

            for (int i = 0; i < Files1.Length; i++)
            {
                //Create a new row
                DataRow drow = dtFileAttachment.NewRow();
                drow["FILES"] = Files1[i];
                dtFileAttachment.Rows.Add(drow);
            }

            gvFileAttachments.DataSource = dtFileAttachment;
            gvFileAttachments.DataBind();
        }
    }
コード例 #9
0
        private void Display()
        {
            BidItem biditem = BidItemTransaction.QueryBidItemInfo(connstring, ViewState["BidRefNo"].ToString().Trim());
            //BidItemInfo biditem = obj.Query("91000");
            BuyerTransaction        buyer    = new BuyerTransaction();
            CategoryTransaction     category = new CategoryTransaction();
            GroupDeptSecTransaction grp      = new GroupDeptSecTransaction();
            CompanyTransaction      cmp      = new CompanyTransaction();
            IncotermTransaction     inc      = new IncotermTransaction();
            OtherTransaction        dte      = new OtherTransaction();

            lblCompany.Text               = cmp.GetCompanyName(connstring, biditem.CompanyId.ToString().Trim());
            lblRequestorName.Text         = biditem.Requestor.ToString().Trim();
            lblPRNumber.Text              = biditem.PRRefNo.ToString().Trim();
            lblPRDate.Text                = biditem.PRDate.ToString().Trim();
            lblGroupDeptSec.Text          = grp.GetGroupDeptSecNameById(connstring, biditem.GroupDeptSec.ToString().Trim());
            lblBidRefNum.Text             = biditem.BidRefNo.ToString().Trim();
            lblSubCategory.Text           = category.GetCategoryNameById(connstring, biditem.Category.ToString().Trim());
            lblBidSubmissionDeadline.Text = biditem.Deadline.ToString().Trim();
            lblBidItemDescription.Text    = biditem.ItemDescription;
            lblDeliverTo.Text             = biditem.DeliverTo;
            lblIncoterm.Text              = inc.GetIncotermName(connstring, biditem.Incoterm);

            DataTable  dtSuppliers = new DataTable();
            DataColumn dcol        = new DataColumn("SUPPLIER", typeof(System.String));

            dtSuppliers.Columns.Add(dcol);

            string suppliers = biditem.Suppliers;

            /*
             *          if (suppliers != "")
             *      btnSubmit.Enabled = true;
             */
            string[] suppliers1 = suppliers.Split(Convert.ToChar(","));

            for (int i = 0; i < suppliers1.Length; i++)
            {
                //Create a new row
                DataRow drow = dtSuppliers.NewRow();
                drow["SUPPLIER"] = suppliers1[i];
                dtSuppliers.Rows.Add(drow);
            }

            gvSuppliers.DataSource = dtSuppliers;
            gvSuppliers.DataBind();

            DataTable  dtFileAttachment = new DataTable();
            DataColumn dcol1            = new DataColumn("FILES", typeof(System.String));

            dtFileAttachment.Columns.Add(dcol1);

            string Files = biditem.FileAttachments;

            string[] Files1 = Files.Split(Convert.ToChar("|"));

            for (int i = 0; i < Files1.Length; i++)
            {
                //Create a new row
                DataRow drow = dtFileAttachment.NewRow();
                drow["FILES"] = Files1[i];
                dtFileAttachment.Rows.Add(drow);
            }

            gvFileAttachments.DataSource = dtFileAttachment;
            gvFileAttachments.DataBind();
        }
コード例 #10
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
            connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
            if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER)
            {
                Response.Redirect("../unauthorizedaccess.aspx");
            }


            if (!(Page.IsPostBack))
            {
                if (Session["BidRefNo"] != null)
                {
                    hdnBidRefNo.Value = Session["BidRefNo"].ToString().Trim();
                    BidItem                 bid      = BidItemTransaction.QueryBidItemInfo(connstring, hdnBidRefNo.Value.Trim());
                    BuyerTransaction        buyer    = new BuyerTransaction();
                    CategoryTransaction     category = new CategoryTransaction();
                    GroupDeptSecTransaction grp      = new GroupDeptSecTransaction();
                    CompanyTransaction      cmp      = new CompanyTransaction();
                    SupplierTransaction     vnd      = new SupplierTransaction();
                    IncotermTransaction     inc      = new IncotermTransaction();
                    OtherTransaction        dte      = new OtherTransaction();

                    lblCompany.Text               = cmp.GetCompanyName(connstring, bid.CompanyId.ToString().Trim());
                    lblRequestor.Text             = bid.Requestor.ToString().Trim();
                    lblPRNumber.Text              = bid.PRRefNo.ToString().Trim();
                    lblPRDate.Text                = bid.PRDate.ToString().Trim();
                    lblGroup.Text                 = grp.GetGroupDeptSecNameById(connstring, bid.GroupDeptSec.ToString().Trim());
                    lblBidReferenceNo.Text        = bid.BidRefNo.ToString().Trim();
                    lblSubCategory.Text           = category.GetCategoryNameById(connstring, bid.Category.ToString().Trim());
                    lblBidSubmissionDeadline.Text = bid.Deadline.ToString().Trim();
                    lblBidItemDescription.Text    = bid.ItemDescription.ToString().Trim();
                    lblDeliverTo.Text             = bid.DeliverTo.ToString().Trim();
                    lblIncoterm.Text              = inc.GetIncotermName(connstring, bid.Incoterm.ToString().Trim());
                    lblBidRefNo2.Text             = bid.BidRefNo.ToString().Trim();

                    FillBidItemDetails();
                    //no checking because when bids are submitted they have suppliers
                    gvSuppliers.DataSource = BidItemTransaction.GetSuppliers(connstring, hdnBidRefNo.Value.Trim());
                    gvSuppliers.DataBind();

                    //DataTable dtFileAttachment = new DataTable();
                    //DataColumn dcol1 = new DataColumn("FILES", typeof(System.String));
                    //dtFileAttachment.Columns.Add(dcol1);

                    //string Files = bid.FileAttachments;
                    //string[] Files1 = Files.Split(Convert.ToChar("|"));

                    //for (int i = 0; i < Files1.Length; i++)
                    //{
                    //    //Create a new row
                    //    DataRow drow = dtFileAttachment.NewRow();
                    //    drow["FILES"] = Files1[i];
                    //    dtFileAttachment.Rows.Add(drow);
                    //}

                    //gvFileAttachments.DataSource = dtFileAttachment;
                    //gvFileAttachments.DataBind();
                }
                else
                {
                    Response.Redirect("index.aspx");
                }
            }
        }
コード例 #11
0
    private void SaveSupplierData()
    {
        string vSuppliertype = "", vCategory = "", vSubcategory = "", vCompanyname = "", vHeadaddress1 = "",
               vHeadaddress2 = "", vHeadtel = "", vHeadtelext = "", vHeadfax = "", vBranchaddress1 = "", vBranchaddress2 = "",
               vBranchtel = "", vBranchtelext = "", vBranchfax = "", vVatregno = "", vTin = "", vPobox = "", vPostalcode = "", vEmail = "",
               vStandardtermsofpayment = "", vSpecialterms = "", vMinimumordervalue = "", vSalesperson = "", vSalespersontelephone = "",
               vTypeofbusinessorganization = "", vOwnershipFilipino = "", vOwnershipOther = "", vCompanyclassification = "", vSolesupplierline1 = "", vSolesupplierline2 = "",
               vSpecialization = "", vKeyPersonnel = "", vKeyPosition = "";

        DataTable dtPresentServices     = new DataTable();
        DataTable dtMajorCustomers      = new DataTable();
        DataTable dtAffiliatedCompanies = new DataTable();
        DataTable dtBanks               = new DataTable();
        DataTable dtExternalAuditors    = new DataTable();
        DataTable dtRelatives           = new DataTable();
        DataTable dtEquipment           = new DataTable();


        ReadFromXMLFile(ref vSuppliertype, ref vCategory, ref vSubcategory, ref vCompanyname, ref vHeadaddress1,
                        ref vHeadaddress2, ref vHeadtel, ref vHeadtelext, ref vHeadfax, ref vBranchaddress1, ref vBranchaddress2,
                        ref vBranchtel, ref vBranchtelext, ref vBranchfax, ref vVatregno, ref vTin, ref vPobox, ref vPostalcode, ref vEmail,
                        ref vStandardtermsofpayment, ref vSpecialterms, ref vMinimumordervalue, ref vSalesperson, ref vSalespersontelephone,
                        ref vTypeofbusinessorganization, ref vOwnershipFilipino, ref vOwnershipOther, ref vCompanyclassification, ref vSolesupplierline1, ref vSolesupplierline2,
                        ref vSpecialization, ref vKeyPersonnel, ref vKeyPosition, ref dtPresentServices, ref dtMajorCustomers, ref dtAffiliatedCompanies,
                        ref dtBanks, ref dtExternalAuditors, ref dtEquipment, ref dtRelatives);

        SupplierTransaction s = new SupplierTransaction();

        if (!s.VendorExists(connstring, vCompanyname.Trim()))
        {
            OtherTransaction oth       = new OtherTransaction();
            string           vUserName = vCompanyname.Replace(" ", "");
            if (vUserName.Length > 8)
            {
                vUserName = vUserName.Substring(0, 8).ToUpper();
            }
            else
            {
                vUserName = vUserName.ToUpper();
            }

            bool IsValidUserName = s.CheckUser(connstring, vUserName.Trim());

            while (!IsValidUserName)
            {
                int ctr = 0;
                vUserName       = vUserName + ctr.ToString().Trim();
                IsValidUserName = s.CheckUser(connstring, vUserName.Trim());
            }
            if (IsValidUserName)
            {
                Session["VendorId"] = s.InsertUser(connstring, vUserName, EncryptionHelper.Encrypt(vUserName), ((int)Constant.USERTYPE.VENDOR).ToString().Trim());
            }
            if (Session["VendorId"].ToString().Trim() != "-1")
            {
                s.RegisterSupplier(connstring, Session["VendorId"].ToString().Trim(), vCompanyname, vSuppliertype, vEmail, vHeadaddress1, vHeadaddress2, vBranchaddress1,
                                   vBranchaddress2, vSalesperson, vSalespersontelephone, "",
                                   vHeadtel, vHeadfax, vHeadtelext, vBranchtel, vBranchfax, vBranchtelext, vVatregno,
                                   vTin, vPobox, vStandardtermsofpayment, vSpecialterms, vMinimumordervalue, vPostalcode,
                                   vOwnershipFilipino, vOwnershipOther, vTypeofbusinessorganization, vSpecialization, vSolesupplierline1,
                                   vSolesupplierline2, vKeyPersonnel, vKeyPosition, GetISOStandard(),
                                   ddlPCABClass.SelectedItem.Value.Trim());

                string[] VendorSubCategory = vSubcategory.Split(Convert.ToChar(","));
                s.InsertSubCategory(connstring, Session["VendorId"].ToString().Trim(), VendorSubCategory);
                string[] VendorCategory = vCategory.Split(Convert.ToChar(","));
                s.InsertCategory(connstring, Session["VendorId"].ToString().Trim(), VendorCategory);
                string[] VendorClassifiction = vCompanyclassification.Split(Convert.ToChar(","));
                s.InsertVendorClassification(connstring, Session["VendorId"].ToString().Trim(), VendorClassifiction);
                s.InsertPresentServices(connstring, Session["VendorId"].ToString().Trim(), dtPresentServices);
                s.InsertMajorCustomers(connstring, Session["VendorId"].ToString().Trim(), dtMajorCustomers);
                s.InsertBanks(connstring, Session["VendorId"].ToString().Trim(), dtBanks);
                s.InsertAffiliatedCompanies(connstring, Session["VendorId"].ToString().Trim(), dtAffiliatedCompanies);
                s.InsertExternalAuditors(Session["VendorId"].ToString().Trim(), dtExternalAuditors);

                s.InsertEquipment(connstring, Session["VendorId"].ToString().Trim(), dtEquipment);
                s.InsertRelative(connstring, Session["VendorId"].ToString().Trim(), dtRelatives);

                s.InsertBrandsMain(connstring, Session["VendorId"].ToString().Trim(), hdnBrands.Text.Trim());
                s.InsertItemsCarriedMain(connstring, Session["VendorId"].ToString().Trim(), hdnItems.Text.Trim());
                s.InsertServicesOfferedMain(connstring, Session["VendorId"].ToString().Trim(), hdnServices.Text.Trim());
                s.InsertLocationMain(connstring, Session["VendorId"].ToString().Trim(), hdnLocation.Text.Trim());
                Session["XMLFile"] = null;
                Response.Redirect("supplierdetails.aspx");
            }
            else
            {
                lblMessage.Text = "Error in inserting user.";
            }
        }
        else
        {
            lblMessage.Text = "Supplier already exists.";
        }
    }