Exemplo n.º 1
0
 public static dsUser.UserInfoRow GetUserInfoByUserId(int userId)
 {
     try
     {
         UserInfoTableAdapter     taUserInfo = new UserInfoTableAdapter();
         dsUser.UserInfoDataTable dtUserInfo = taUserInfo.GetUserInfoById(userId);
         if (dtUserInfo.Rows.Count > 0)
         {
             return(dtUserInfo[0]);
         }
         return(null);
     }
     catch { return(null); }
 }
Exemplo n.º 2
0
 public static dsUser.UserInfoRow GetUserInfo(string email, string password)
 {
     try
     {
         UserInfoTableAdapter     taUserInfo = new UserInfoTableAdapter();
         dsUser.UserInfoDataTable dtUserInfo = taUserInfo.GetUserInfo(email, password);
         if (dtUserInfo.Rows.Count > 0)
         {
             return(dtUserInfo[0]);
         }
         return(null);
     }
     catch { return(null); }
 }
Exemplo n.º 3
0
 public static int GetUserId(string email, string password)
 {
     try
     {
         UserInfoTableAdapter     taUserInfo = new UserInfoTableAdapter();
         dsUser.UserInfoDataTable dtUserInfo = taUserInfo.GetUserInfo(email, password);
         int userId = 0;
         if (dtUserInfo.Rows.Count > 0)
         {
             userId = Convert.ToInt32(dtUserInfo[0]["UserId"]);
         }
         return(userId);
     }
     catch { return(0); }
 }
Exemplo n.º 4
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.";
        }
    }
Exemplo n.º 5
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.";
        }
    }