protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            // fetch the en-GB culture
            CultureInfo ukCulture = new CultureInfo("en-GB");
            // pass the DateTimeFormat information to DateTime.Parse
            DateTime dt = DateTime.Parse(txtCommencementDate.Text, ukCulture.DateTimeFormat);
            DateTime dt1 = DateTime.Parse(txtRegistrationDate.Text, ukCulture.DateTimeFormat);

            if (this.type.Value != "update")
            {
                
                LoanDSTableAdapters.CoporateInformationTableAdapter companyDetails = new LoanDSTableAdapters.CoporateInformationTableAdapter();
                companyDetails.InsertCoporateInformation(MySessionManager.AppID,
                                                          MySessionManager.ClientID,
                                                          txtCompanyName.Value,
                                                          dt,
                                                          Convert.ToInt32(txtYearsInBusiness.Value.Trim()),
                                                          Convert.ToInt32(ddlIndustryType.Text),
                                                          Convert.ToInt32(ddlSector.SelectedValue),
                                                          txtPhysicalAddress.Value.Trim(),
                                                          txtTel1.Value.Trim(),
                                                          txtTel2.Value.Trim(),
                                                          txtFax.Value.Trim(),
                                                          txtNatureofbusiness.Value.Trim(),
                                                          ddlPremisesStatus.Text,
                                                          Convert.ToInt32(ddlRegistered.Text),
                                                          dt1,
                                                          txtRegistrationNumber.Text,
                                                          txtVATNo.Value.Trim(),
                                                          txtTIN.Value.Trim(),
                                                          txtwebsite.Value.Trim(),
                                                          MySessionManager.CurrentUser.UserID
                                                           );
                this.editskip.Value = "1";
            }
            else if (this.type.Value == "update")
            {
                
                LoanDSTableAdapters.CoporateInformationTableAdapter companyDetails = new LoanDSTableAdapters.CoporateInformationTableAdapter();
                companyDetails.UpdateCoporateInformation(txtCompanyName.Value,
                                                          dt,
                                                          Convert.ToInt32(txtYearsInBusiness.Value.Trim()),
                                                          Convert.ToInt32(ddlIndustryType.Text),
                                                          Convert.ToInt32(ddlSector.SelectedValue),
                                                          txtPhysicalAddress.Value.Trim(),
                                                          txtTel1.Value.Trim(),
                                                          txtTel2.Value.Trim(),
                                                          txtFax.Value.Trim(),
                                                          txtNatureofbusiness.Value.Trim(),
                                                          ddlPremisesStatus.Text,
                                                          Convert.ToInt32(ddlRegistered.Text),
                                                          dt1,
                                                          txtRegistrationNumber.Text,
                                                          txtVATNo.Value.Trim(),
                                                          txtTIN.Value.Trim(),
                                                          txtwebsite.Value.Trim(),
                                                          MySessionManager.ClientID
                                                           );
                this.editskip.Value = "1";
            }
        }
        catch
        { }
    }
Esempio n. 2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime dt1 = DateTime.Parse("1/1/1953");
            if (txtRegistrationDate.Text == "")
            {
                dt1 = DateTime.Parse("1/1/1753");
            }
            else
            {
                dt1 = DateTime.Parse(txtRegistrationDate.Text);
            }

            if (this.type.Value != "update")
            {
                DateTime dt = DateTime.Parse(txtCommencementDate.Text);
                LoanDSTableAdapters.CoporateInformationTableAdapter companyDetails = new LoanDSTableAdapters.CoporateInformationTableAdapter();
                companyDetails.InsertCoporateInformation(MySessionManager.AppID,
                                                         MySessionManager.ClientID,
                                                         txtCompanyName.Value,
                                                         dt,
                                                         Convert.ToInt32(txtYearsInBusiness.Value.Trim()),
                                                         Convert.ToInt32(ddlIndustryType.Text),
                                                         Convert.ToInt32(ddlSector.SelectedValue),
                                                         txtPhysicalAddress.Value.Trim(),
                                                         txtTel1.Value.Trim(),
                                                         txtTel2.Value.Trim(),
                                                         txtFax.Value.Trim(),
                                                         txtNatureofbusiness.Value.Trim(),
                                                         ddlPremisesStatus.Text,
                                                         Convert.ToInt32(ddlRegistered.Text),
                                                         dt1,
                                                         txtRegistrationNumber.Text,
                                                         txtVATNo.Value.Trim(),
                                                         txtTIN.Value.Trim(),
                                                         txtwebsite.Value.Trim(),
                                                         MySessionManager.CurrentUser.UserID
                                                         );
                this.editskip.Value = "1";
            }
            else if (this.type.Value == "update")
            {
                DateTime dt = DateTime.Parse(txtCommencementDate.Text);
                LoanDSTableAdapters.CoporateInformationTableAdapter companyDetails = new LoanDSTableAdapters.CoporateInformationTableAdapter();
                companyDetails.UpdateCoporateInformation(txtCompanyName.Value,
                                                         dt,
                                                         Convert.ToInt32(txtYearsInBusiness.Value.Trim()),
                                                         Convert.ToInt32(ddlIndustryType.Text),
                                                         Convert.ToInt32(ddlSector.SelectedValue),
                                                         txtPhysicalAddress.Value.Trim(),
                                                         txtTel1.Value.Trim(),
                                                         txtTel2.Value.Trim(),
                                                         txtFax.Value.Trim(),
                                                         txtNatureofbusiness.Value.Trim(),
                                                         ddlPremisesStatus.Text,
                                                         Convert.ToInt32(ddlRegistered.Text),
                                                         dt1,
                                                         txtRegistrationNumber.Text,
                                                         txtVATNo.Value.Trim(),
                                                         txtTIN.Value.Trim(),
                                                         txtwebsite.Value.Trim(),
                                                         MySessionManager.ClientID
                                                         );
                this.editskip.Value = "1";
            }
        }
        catch
        { }
    }