protected void ButtonSubmit_Click(object sender, EventArgs e) { int userId = Convert.ToInt32(Session["UserId"]); Classes.UserProfileSet ups = new Classes.UserProfileSet(); int status = 0; switch (HiddenFieldMode.Value.ToLower()) { case "firstname": status = ups.firstName(userId, TextBoxFirstName.Text); break; case "lastname": status = ups.lastName(userId, TextBoxLastName.Text); break; case "username": //-1 exists before -2 username not valid -3 no special char -4 enter username 1 successful status = ups.username(userId, TextBoxUsername.Text); HiddenFieldStatus.Value = status.ToString(); if (status != 1) { Classes.UserInfo ui = new Classes.UserInfo(); TextBoxUsername.Text = ui.getUsernameByUserId(userId); } break; case "gender": status = ups.gender(userId, Convert.ToInt16(DropDownListGender.SelectedValue)); break; case "dob": status = ups.birthDate(userId, HiddenFieldDOB.Value); break; case "about": status = ups.about(userId, TextBoxAbout.Text); break; case "photo": bool hasPhoto = Convert.ToBoolean(HiddenFieldValue.Value); status = ups.hasPhoto(userId, hasPhoto); break; case "cover": status = ups.cover(userId, Convert.ToInt16(HiddenFieldValue.Value)); break; case "location": status = ups.location(userId, Convert.ToInt32(HiddenFieldLocationId.Value)); Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(DropDownListCity.SelectedValue)); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString(); } break; case "notifications": bool getNotifications = Convert.ToBoolean(HiddenFieldNotifications.Value); status = ups.notifications(userId, getNotifications); break; case "mobile": status = ups.mobile(userId, Convert.ToInt64(TextBoxMobile.Text)); break; } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { int userId = Convert.ToInt32(Session["UserId"]); Classes.UserProfileSet ups = new Classes.UserProfileSet(); int status = 0; switch (HiddenFieldMode.Value.ToLower()) { case "firstname": status = ups.firstName(userId, TextBoxFirstName.Text); break; case "lastname": status = ups.lastName(userId, TextBoxLastName.Text); break; case "username": //-1 exists before -2 username not valid -3 no special char -4 enter username 1 successful status = ups.username(userId, TextBoxUsername.Text); HiddenFieldStatus.Value = status.ToString(); if (status != 1) { Classes.UserInfo ui = new Classes.UserInfo(); TextBoxUsername.Text = ui.getUsernameByUserId(userId); } break; case "gender": status = ups.gender(userId, Convert.ToInt16(DropDownListGender.SelectedValue)); break; case "dob": status = ups.birthDate(userId, HiddenFieldDOB.Value); break; case "about": status = ups.about(userId, TextBoxAbout.Text); break; case "photo": bool hasPhoto = Convert.ToBoolean(HiddenFieldValue.Value); status = ups.hasPhoto(userId, hasPhoto); break; case "cover": status = ups.cover(userId, Convert.ToInt16(HiddenFieldValue.Value)); break; case "location": status = ups.location(userId, Convert.ToInt32(HiddenFieldLocationId.Value)); Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(DropDownListCity.SelectedValue)); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString(); } break; case "notifications": bool getNotifications = Convert.ToBoolean(HiddenFieldNotifications.Value); status = ups.notifications(userId, getNotifications); break; case "mobile": status = ups.mobile(userId, Convert.ToInt64(TextBoxMobile.Text)); break; } }