protected void btnSaveChanges_Click(object sender, EventArgs e) { try { using (AdGiverRT receiverTransfer = new AdGiverRT()) { string userEmailId = Convert.ToString(Session["UserName"]); AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId); if (adgiverEmailId != null) { AdGiver adGiverNamePhn = CreateadGiverNamePhn(); receiverTransfer.UpdateadGiverAccNamePhn(userEmailId, adGiverNamePhn.Name, adGiverNamePhn.PhoneNo1); lblAccountdetails.Text = "Name and Phone No. successfully updated..."; lblAccountdetails.ForeColor = System.Drawing.Color.Green; } else { lblAccountdetails.Text = "Name and Phone No. not updated..."; lblAccountdetails.ForeColor = System.Drawing.Color.Red; } } } catch (Exception ex) { lblAccountdetails.Text = "Error : " + ex.Message; lblAccountdetails.ForeColor = System.Drawing.Color.Red; } //clearfield(); showUserNamePhn(); }
protected void btnDeactive_Click(object sender, EventArgs e) { try { using (AdGiverRT receiverTransfer = new AdGiverRT()) { string userEmailId = Convert.ToString(Session["UserName"]); AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId); if (adgiverEmailId != null) { using (UserInformationRT receiverTransferuserinfo = new UserInformationRT()) { UserInfo UserDeactive = CreateUserDeactive(); receiverTransferuserinfo.UpdateUserDeactive(userEmailId, UserDeactive.Comments, UserDeactive.LeavingCausesID, UserDeactive.IsActiveUser); Session["UserName"] = null; Response.Redirect("~/"); } } else { lblAccountdetails.Text = "Account is not Deactivated Yet"; lblAccountdetails.ForeColor = System.Drawing.Color.Red; } } } catch (Exception ex) { lblAccountdetails.Text = "Error : " + ex.Message; lblAccountdetails.ForeColor = System.Drawing.Color.Red; } }
public void RegisteredUserListView() { try { using (AddGiverTracingRT receiverTransfer = new AddGiverTracingRT()) { Int64 userId = Convert.ToInt64(Session["RegistereduserID"]); List <AdGiverTracing> adgivertracing = receiverTransfer.GetAdGiverTracingByIID(userId); if (adgivertracing != null && adgivertracing.Count > 0) { lvRegisteredUserAddGiverTracing.DataSource = receiverTransfer.GetAdGiverTracingListViewByIID(Convert.ToInt64(userId)); lvRegisteredUserAddGiverTracing.DataBind(); using (AdGiverRT receiverTransferAdgiver = new AdGiverRT()) { AdGiver e = receiverTransferAdgiver.GetAdGiverByIID(Convert.ToInt64(userId)); labelDisplayName.Text = "Welcome " + e.Name; labelDisplayEmail.Text = "Your Email Address : " + e.EmailID; labellistview.Text = e.Name + "'s Add Giver Tracing Information"; } } } } catch (Exception ex) { labelMessageRegisteredUserAddGiverTracing.Text = "Error : " + ex.Message; labelMessageRegisteredUserAddGiverTracing.ForeColor = System.Drawing.Color.Red; } }
protected void btnChngPass_Click(object sender, EventArgs e) { try { using (AdGiverRT receiverTransfer = new AdGiverRT()) { string userEmailId = Convert.ToString(Session["UserName"]); string password = txtCurrentPass.Text; AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId); string UserpassWord = StringCipher.Decrypt(receiverTransfer.GetPasswordIDByEmail(userEmailId).LoginPassword); if (adgiverEmailId != null && UserpassWord == password) { using (UserInformationRT receiverTransferuserinfo = new UserInformationRT()) { UserInfo UserInfoPassword = CreateUserInfoPassword(); receiverTransferuserinfo.UpdateUserInfoPassword(userEmailId, StringCipher.Encrypt(UserInfoPassword.LoginPassword)); lblAccountdetails.Text = "Password successfully updated..."; lblAccountdetails.ForeColor = System.Drawing.Color.Green; } } else { lblAccountdetails.Text = "Current Password is not Valid"; lblAccountdetails.ForeColor = System.Drawing.Color.Red; } } } catch (Exception ex) { lblAccountdetails.Text = "Error : " + ex.Message; lblAccountdetails.ForeColor = System.Drawing.Color.Red; } clearfield(); }
public AdGiver CreateAdGiver() { AdGiver adgiver = new AdGiver(); try { using (AdGiverRT adGiverRt = new AdGiverRT()) { bool IsThisEmailAlreadyExist = adGiverRt.GetAdGiverIDByEmail(txtEmail.Text) != null; if (IsThisEmailAlreadyExist) { return(null); } adgiver.Name = txtAdGiverName.Text; adgiver.ClientTypeID = Convert.ToInt32(dropDownClientType.SelectedValue); adgiver.NationalID = txtNationalID.Text; adgiver.CompanyOrOrganizationName = txtCompanyName.Text; adgiver.ComOrOrgAddress = txtCompanyAddress.Text; adgiver.ComOrOrgPhone = txtCompanyPhoneNo.Text; adgiver.EmailID = txtEmail.Text; adgiver.PhoneNo1 = txtContactNo.Text; adgiver.PhoneNo2 = txtPhNoOptional.Text; adgiver.LocationID = Convert.ToInt32(txtLocation.Text); } } catch (Exception ex) { labelMessage.Text = "Error : " + ex.Message; labelMessage.ForeColor = System.Drawing.Color.Red; } return(adgiver); }
public void AddAdGiver(AdGiver adGiver) { try { DatabaseHelper.Insert <AdGiver>(adGiver); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
protected void btn_CreateAccount_Click(object sender, EventArgs e) { try { using (AdGiverRT adGiverRt = new AdGiverRT()) { UserInformationRT aUserInformationRt = new UserInformationRT(); UserInfo aUserInfo = new UserInfo(); AdGiver adGiver = new AdGiver(); adGiver = CreateAdGiver(); if (adGiver != null) { // const int userInGroup = 7; //for addgiver adGiverRt.AddAdGiver(adGiver); aUserInfo = CreateUserInfo(adGiver.IID); aUserInformationRt.AddUserInfo(aUserInfo); } else { if (txtPassword.Text == string.Empty || txtPassword.Text == "") { labelMessage.Text = "Please enter your password"; } else if (txtConfirmPassword.Text == "" || txtConfirmPassword.Text == string.Empty) { labelMessage.Text = "Please comfirm your password"; } else if (txtPassword.Text != txtConfirmPassword.Text) { labelMessage.Text = "password doesn't match"; } else if (txtPassword.Text.Length < 6) { labelMessage.Text = "password too short, enter at least 6 character"; } else { labelMessage.Text = string.Format("The email address {0} already registered ", txtEmail.Text.Trim()); } labelMessage.ForeColor = System.Drawing.Color.Red; //ClearField(); return; } labelMessage.Text = "you have registered successfully...and your user ID is " + adGiver.EmailID; labelMessage.ForeColor = System.Drawing.Color.Green; ClearField(); } } catch (Exception ex) { labelMessage.Text = "Error : " + ex.Message; labelMessage.ForeColor = System.Drawing.Color.Red; } }
protected void lvMyfvrt_ItemCommand(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "DeleteMyfvrt") { try { lblMyfabourite.Text = string.Empty; int MyfabouriteID = Convert.ToInt32(e.CommandArgument); hdmyfvrt.Value = MyfabouriteID.ToString(); using (MyFavouriteRT receiverTransfer = new MyFavouriteRT()) { receiverTransfer.DeleteMyfabourite(MyfabouriteID); lblMyfabourite.Text = "Data successfully deleted..."; lblMyfabourite.ForeColor = System.Drawing.Color.Green; } } catch (Exception ex) { lblMyfabourite.Text = "Error : " + ex.Message; lblMyfabourite.ForeColor = System.Drawing.Color.Red; } } else if (e.CommandName == "EditMyfvrt") { try { using (AdGiverRT receiverTransfer = new AdGiverRT()) { lblMyfabourite.Text = string.Empty; string userEmailId = Convert.ToString(Session["UserName"]); AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId); using (MyFavouriteRT receiverTransferMyfvrt = new MyFavouriteRT()) { //int MaterialID = Convert.ToInt32(Request.QueryString["ID"]); List <MyFavourite> EmailIDfrmMyfvrt = receiverTransferMyfvrt.GetEmailIDfrmMyfvrt(userEmailId); if (adgiverEmailId.EmailID != null && EmailIDfrmMyfvrt != null && EmailIDfrmMyfvrt.Count > 0) { int UrlID = Convert.ToInt32(e.CommandArgument); MyFavourite url = receiverTransferMyfvrt.GetUrlFrmMyfvrt(UrlID); Response.Redirect("DetailPage?option=" + StringCipher.Encrypt(url.MaterialID.ToString())); } } } } catch (Exception ex) { lblMyfabourite.Text = "Error : " + ex.Message; lblMyfabourite.ForeColor = System.Drawing.Color.Red; } } }
//public object UpdateadGiverAccNamePhn(string userEmailId) //{ // OiiOHaatDCDataContext dbContext = DatabaseHelper.GetDataModelDataContext(); // AdGiver adgiveracc = new AdGiver(); // var adGiveracc = dbContext.SpGetAllPoliceStation(userEmailId); // return adGiveracc; //} public object UpdateadGiverAccNamePhn(string userEmailId, string Name, string PhoneNo1) { try { OiiOHaatDCDataContext dbContext = DatabaseHelper.GetDataModelDataContext(); AdGiver adgiveracc = new AdGiver(); var adGiveracc = dbContext.sp_UpdateAccNamePhone(userEmailId, Name, PhoneNo1); return(adGiveracc); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
protected void btnPostAd_Click(object sender, EventArgs e) { try { using (MaterialRT receiverTransfer = new MaterialRT()) { AdGiverRT adGiverRt = new AdGiverRT(); string matCode = string.Empty; AdGiver adGiver = new AdGiver(); Material material = CreateMaterial(); if (material.AdGiverID == -1) { adGiver = CreateAdGiver(); if (adGiver != null) { adGiverRt.AddAdGiver(adGiver); material.AdGiverID = adGiverRt.GetAdGiverIDByEmail(adGiver.EmailID).IID; receiverTransfer.AddMaterial(material); matCode = material.Code; } } else { receiverTransfer.AddMaterial(material); matCode = material.Code; } if (material.IID > 0) { labelMessage.Text = "Your ad successfully posted...and your material code is " + matCode; labelMessage.ForeColor = System.Drawing.Color.Green; ClearField(); } else if (adGiver == null) { labelMessage.Text = "This email already taken..."; labelMessage.ForeColor = System.Drawing.Color.Red; } else { labelMessage.Text = "Data not saved..."; labelMessage.ForeColor = System.Drawing.Color.Red; } } } catch (Exception ex) { labelMessage.Text = "Error : " + ex.Message; labelMessage.ForeColor = System.Drawing.Color.Red; } }
protected void btnFvrt_Click(object sender, EventArgs e) { try { if (Session["UserName"] == null) { Response.Redirect("~/LoginPage"); } else { using (AdGiverRT receiverTransfer = new AdGiverRT()) { string userEmailId = Convert.ToString(Session["UserName"]); AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId); if (adgiverEmailId != null) { using (MyFavouriteRT receiverTransferMyfvrt = new MyFavouriteRT()) { int MaterialID = Convert.ToInt32(Session["detailID"]); MyFavourite EmailIDnMaterialID = receiverTransferMyfvrt.GetEmailIDnMaterialID(userEmailId, MaterialID); MyFavourite myFvrt = CreatemyFavrt(); if (EmailIDnMaterialID == null) { receiverTransferMyfvrt.AddMYFvrt(myFvrt); lblFvrt.Text = "You Add your Favourite Item Successfully..."; lblFvrt.ForeColor = System.Drawing.Color.DarkSlateBlue; } else { lblFvrt.Text = "This Item is already added to your Favourite..."; lblFvrt.ForeColor = System.Drawing.Color.Red; } } } else { lblFvrt.Text = "Data not Added..."; lblFvrt.ForeColor = System.Drawing.Color.Red; } } } } catch (Exception ex) { lblFvrt.Text = "Error : " + ex.Message; lblFvrt.ForeColor = System.Drawing.Color.Red; } }
private AdGiver CreateadGiverNamePhn() { AdGiver adGiver = new AdGiver(); try { adGiver.PhoneNo1 = txtpNo.Text; adGiver.Name = txtfName.Text + " " + txtlName.Text; } catch (Exception ex) { lblAccountdetails.Text = "Error : " + ex.Message; lblAccountdetails.ForeColor = System.Drawing.Color.Red; } return(adGiver); }
private void showUserNamePhn() { try { using (AdGiverRT receiverTransfer = new AdGiverRT()) { string userEmailId = Convert.ToString(Session["UserName"]); AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId); var info = receiverTransfer.GetAdGiverNamePhnByEmail(userEmailId); if (adgiverEmailId != null) { txtfName.Text = info[0].firstname; txtlName.Text = info[0].lastname; txtpNo.Text = info[0].PhoneNo1; } } } catch (Exception ex) { lblAccountdetails.Text = "Error : " + ex.Message; lblAccountdetails.ForeColor = System.Drawing.Color.Red; } }
//private void LoadClientTypeDropDownInfo() //{ // try // { // DropDownListHelper.Bind(dropDownClientType, EnumHelper.EnumToList<EnumCollection.ClientType>()); // } // catch (Exception ex) // { // throw new Exception(ex.Message, ex); // } //} public AdGiver CreateAdGiver() { AdGiver adgiver = new AdGiver(); try { using (AdGiverRT adGiverRt = new AdGiverRT()) { bool IsThisEmailAlreadyExist = adGiverRt.GetAdGiverIDByEmail(txtEmail.Text) != null; if (txtPassword.Text.Length < 6 || IsThisEmailAlreadyExist || (txtPassword.Text != txtConfirmPassword.Text) || txtPassword.Text == string.Empty || txtPassword.Text == "" || txtConfirmPassword.Text == "" || txtConfirmPassword.Text == string.Empty) { return(null); } adgiver.Name = txtFirstName.Text + " " + txtLastname.Text; adgiver.ClientTypeID = Convert.ToInt32(dropDownClientType.SelectedValue); //if (txtNationalID.Text != "" && txtNationalID.Text != string.Empty) //{ // adgiver.NationalID = txtNationalID.Text; //} if (adgiver.ClientTypeID == Convert.ToInt32(EnumCollection.ClientType.OrganiztionOrCompany)) { //adgiver.CompanyOrOrganizationName = txtCompanyName.Text; //adgiver.ComOrOrgAddress = txtCompanyAddress.Text; //adgiver.ComOrOrgPhone = txtCompanyPhoneNo.Text; } adgiver.EmailID = txtEmail.Text; adgiver.PhoneNo1 = txtContactNo.Text; //if (txtNationalID.Text != "" && txtNationalID.Text != string.Empty) //{ // //adgiver.PhoneNo2 = txtPhNoOptional.Text; //} //if (txtLocationID.Text != "" || txtLocationID.Text != string.Empty) //{ // adgiver.LocationID = Convert.ToInt64(txtLocationID.Text); //} //else //{ //try //{ // using (LocationRT aLocationRt = new LocationRT()) // { // Location aLocation = new Location(); // if (txtLocation.Text != "" || txtLocation.Text != string.Empty) // { // aLocation.CurrentLocation = txtLocation.Text; // aLocation.DistrictID = Convert.ToInt64(txtDistrictID.Text.Trim() != null ? txtDistrictID.Text.Trim() : null); // aLocation.PoliceStationID = Convert.ToInt64(txtPoliceStationID.Text.Trim() != null ? txtPoliceStationID.Text.Trim() : null); // aLocation.CountryID = Convert.ToInt32(hdCountryID.Value); // aLocation.CurrentLocation = txtLocation.Text; // aLocationRt.AddLocation(aLocation); // adgiver.LocationID = aLocation.IID; // } // } //} //catch (Exception exception) //{ // throw new Exception(exception.Message, exception); //} //} } } catch (Exception ex) { labelMessage.Text = "Error : " + ex.Message; labelMessage.ForeColor = System.Drawing.Color.Red; } return(adgiver); }