示例#1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        lblResult.Text = "";
        try
        {
            dsUser.UserInfoDataTable tbUserInfo = new dsUser.UserInfoDataTable();
            PilotDL.dsUserTableAdapters.UserInfoTableAdapter taUserInfo = new PilotDL.dsUserTableAdapters.UserInfoTableAdapter();
            dsUser.UserInfoRow row = tbUserInfo.NewUserInfoRow();

            //Save User Information
            row.FName = txtFName.Text;
            row.LName = txtLName.Text;
            row.Street = txtStreet.Text;
            row.Apartment = txtApartment.Text;
            row.City = txtCity.Text;
            row.Phone = txtPhone.Text;
            row.State = txtState.Text;
            row.ZIP = txtZip.Text;

            row.UtilityAccountNumber = txtUtilityAccountNumber.Text;

            //Save Billing Info
            row.B_FName = txtB_FName.Text;
            row.B_LName = txtB_LName.Text;
            row.B_Street = txtB_Street.Text;
            row.B_Apartment = txtB_Apartment.Text;
            row.B_City = txtB_City.Text;
            row.B_State = txtB_State.Text;
            row.B_ZIP = txtB_Zip.Text;
            row.B_Phone = txtB_Phone.Text;
            row.B_email = txtB_Email.Text;

            if (Session["LoggedUserId"] != null)
            {
                if (!Session["LoggedUserId"].Equals(string.Empty))
                {
                    row.UserID = Convert.ToInt32(Session["LoggedUserId"]);
                    row.logonEmail = txtEmail.Text;
                    if (!txtPassword.Text.Equals(string.Empty))
                        row.logonPW = txtPassword.Text;
                    else
                        row.logonPW = "";
                    if(UserBL.UpdateUserInfo(row))
                        lblSaveResult.Text = "Information Successfully Saved.";
                    else
                        lblSaveResult.Text = "Error Occurred. Please Try Later.";
                }
                else
                {
                    //row.logonEmail = txtEmail_NewUser.Text;
                    //row.logonPW = txtPassword_NewUser.Text;
                    InsertNewUser(row);
                    return;
                }
            }
            else
            {
                //row.logonEmail = txtEmail_NewUser.Text;
                //row.logonPW = txtPassword_NewUser.Text;
                InsertNewUser(row);
            }
        }
        catch
        {
            lblSaveResult.Text = "Error occured. Please try later.";
        }
    }
示例#2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        lblResult.Text = "";
        try
        {
            dsUser.UserInfoDataTable tbUserInfo = new dsUser.UserInfoDataTable();
            PilotDL.dsUserTableAdapters.UserInfoTableAdapter taUserInfo = new PilotDL.dsUserTableAdapters.UserInfoTableAdapter();
            dsUser.UserInfoRow row = tbUserInfo.NewUserInfoRow();

            //Save User Information
            row.FName     = txtFName.Text;
            row.LName     = txtLName.Text;
            row.Street    = txtStreet.Text;
            row.Apartment = txtApartment.Text;
            row.City      = txtCity.Text;
            row.Phone     = txtPhone.Text;
            row.State     = txtState.Text;
            row.ZIP       = txtZip.Text;

            row.UtilityAccountNumber = txtUtilityAccountNumber.Text;

            //Save Billing Info
            row.B_FName     = txtB_FName.Text;
            row.B_LName     = txtB_LName.Text;
            row.B_Street    = txtB_Street.Text;
            row.B_Apartment = txtB_Apartment.Text;
            row.B_City      = txtB_City.Text;
            row.B_State     = txtB_State.Text;
            row.B_ZIP       = txtB_Zip.Text;
            row.B_Phone     = txtB_Phone.Text;
            row.B_email     = txtB_Email.Text;

            if (Session["LoggedUserId"] != null)
            {
                if (!Session["LoggedUserId"].Equals(string.Empty))
                {
                    row.UserID     = Convert.ToInt32(Session["LoggedUserId"]);
                    row.logonEmail = txtEmail.Text;
                    if (!txtPassword.Text.Equals(string.Empty))
                    {
                        row.logonPW = txtPassword.Text;
                    }
                    else
                    {
                        row.logonPW = "";
                    }
                    if (UserBL.UpdateUserInfo(row))
                    {
                        lblSaveResult.Text = "Information Successfully Saved.";
                    }
                    else
                    {
                        lblSaveResult.Text = "Error Occurred. Please Try Later.";
                    }
                }
                else
                {
                    //row.logonEmail = txtEmail_NewUser.Text;
                    //row.logonPW = txtPassword_NewUser.Text;
                    InsertNewUser(row);
                    return;
                }
            }
            else
            {
                //row.logonEmail = txtEmail_NewUser.Text;
                //row.logonPW = txtPassword_NewUser.Text;
                InsertNewUser(row);
            }
        }
        catch
        {
            lblSaveResult.Text = "Error occured. Please try later.";
        }
    }