protected void btn_Click(object sender, EventArgs e) { try { string fud = fudPhoto.FileName; if (txtName.Text.Trim() != "" && txtMobileNumber.Text.Trim() != "" && txtEmailId.Text.Trim() != "" && txtAddress.Text.Trim() != "" && ddlDay.SelectedIndex != 0 && ddlMonth.SelectedIndex != 0 && ddlYear.SelectedIndex != 0 && fud != "") { //DateTime date = Convert.ToDateTime(txtDateofBirth.Text.Trim()); //string d2 = date.ToString("MM/dd/yyyy"); Admin_User objAdmin_User = new Admin_User(); objAdmin_User.Address = txtAddress.Text.Trim(); objAdmin_User.EmailId = txtEmailId.Text.Trim(); objAdmin_User.Mobile = txtMobileNumber.Text.Trim(); objAdmin_User.Name = txtName.Text.Trim(); objAdmin_User.DOB = Convert.ToDateTime(ddlMonth.SelectedValue.ToString() + "/" + ddlDay.SelectedValue.ToString() + "/" + ddlYear.SelectedItem.ToString()); objAdmin_User.RegisterId = Convert.ToInt32(lblRegisterId.Text.Trim()); objAdmin_User.DumpEmailId = lblDumpEmailId.Text.Trim(); objAdmin_User.CityId = Convert.ToInt32(ddlCity.SelectedValue.ToString()); objAdmin_User.UserId = Convert.ToInt32(Session["UserId"].ToString()); objAdmin_User.CreatedDate = DateTime.Now.AddHours(Connection.SetHours); objAdmin_User.Gender = rdbMale.Checked ? "Male" : "Female"; if (fud != "") { objAdmin_User.Img = "Img"; } else { objAdmin_User.Img = ""; } DataSet objDataSet = Admin_User.Send_User_To_DB(objAdmin_User); if (Convert.ToInt32(objDataSet.Tables[0].Rows[0][1].ToString()) == 1) { if (fud != "") { fudPhoto.SaveAs(Server.MapPath("~/User_Photos/") + "Img_" + objDataSet.Tables[0].Rows[0][0].ToString() + ".jpg"); } ShowNotification("Profile", "Inserted Successfully..", NotificationType.success); User_Profile(); Display_List(gvUserlist, "SELECT Register_Id,Name,Mobile_No,EmailId,Address,Isactive,(Select City_Name from tbl_admin_city C where C.City_Id=RU.City_Id)as City_Name,Photo,convert(varchar(12),DOB,103)as DOB,(Select Username from tbl_user U where U.Staff_Id=RU.Register_Id)as Username,(Select Password from tbl_user U where U.Staff_Id=RU.Register_Id)as Password FROM tbl_Register_User RU order by Register_Id desc"); } else if (Convert.ToInt32(objDataSet.Tables[0].Rows[0][1].ToString()) == -5) { ShowNotification("Profile", "EmailId is already existed..", NotificationType.error); txtEmailId.Focus(); } } else { ShowNotification("Profile", "Please fill all fields..!", NotificationType.error); } } catch (Exception Ex) { } }
protected void btnUpdateProfile_Click(object sender, EventArgs e) { try { string fud = fudPhoto.FileName; if (txtName.Text.Trim() != "" && txtMobileNumber.Text.Trim() != "" && txtEmailId.Text.Trim() != "" && txtAddress.Text.Trim() != "" && ddlDay.SelectedIndex != 0 && ddlMonth.SelectedIndex != 0 && ddlYear.SelectedIndex != 0) { Admin_User objAdmin_User = new Admin_User(); objAdmin_User.Address = txtAddress.Text.Trim(); objAdmin_User.EmailId = txtEmailId.Text.Trim(); objAdmin_User.Mobile = txtMobileNumber.Text.Trim(); objAdmin_User.Name = txtName.Text.Trim(); objAdmin_User.DOB = Convert.ToDateTime(ddlMonth.SelectedValue.ToString() + "/" + ddlDay.SelectedValue.ToString() + "/" + ddlYear.SelectedItem.ToString()); objAdmin_User.RegisterId = Convert.ToInt32(lblRegisterId.Text.Trim()); objAdmin_User.DumpEmailId = lblDumpEmailId.Text.Trim(); objAdmin_User.CityId = Convert.ToInt32(ddlCity.SelectedValue.ToString()); objAdmin_User.UserId = Convert.ToInt32(Session["UserId"].ToString()); objAdmin_User.CreatedDate = DateTime.Now.AddHours(Connection.SetHours); objAdmin_User.Gender = rdbMale.Checked ? "Male" : "Female"; objAdmin_User.DumpCityId = lblDumpCityId.Text.Trim(); if (fud != "") { objAdmin_User.Img = "Img"; } else { objAdmin_User.Img = ""; } DataSet objDataSet = Admin_User.Send_User_To_DB(objAdmin_User); if (Convert.ToInt32(objDataSet.Tables[0].Rows[0][0].ToString()) > 0) { if (fud != "") { fudPhoto.SaveAs(Server.MapPath("~/User_Photos/") + "Img_" + lblRegisterId.Text.Trim() + ".jpg"); } ShowNotification("Profile", "Updated Successfully..", NotificationType.success); User_Profile(); } } else { ShowNotification("Profile", "Please fill all fields..!", NotificationType.error); } } catch (Exception Ex) { } }
public void Send_To_DB() { try { Admin_User objAdmin_User = new Admin_User(); objAdmin_User.Address = txtAddress.Text.Trim(); objAdmin_User.EmailId = txtEmailId.Text.Trim(); objAdmin_User.Mobile = txtMobileNumber.Text.Trim(); objAdmin_User.Name = txtName.Text.Trim(); objAdmin_User.DOB = Convert.ToDateTime("1999-1-1"); objAdmin_User.RegisterId = 0; objAdmin_User.DumpEmailId = ""; objAdmin_User.Img = ""; objAdmin_User.CityId = Convert.ToInt32(ddlCity.SelectedValue.ToString()); objAdmin_User.UserId = 0; objAdmin_User.CreatedDate = DateTime.Now.AddHours(Connection.SetHours); DataSet objDataSet12 = Admin_User.Send_User_To_DB(objAdmin_User); if (objDataSet12.Tables[0].Rows[0][1].ToString() == "1") { objDataSet = MasterCode.RetrieveQuery("select User_Id,Isactive,Username,UserCode,UserRights from tbl_user where Username='******'"); DataTable menuData = new DataTable(); menuData = GetMenuData(objDataSet.Tables[0].Rows[0]["UserRights"].ToString()); AddTopMenuItems(menuData); Session["Menu"] = menu.Replace("<ul></ul>", ""); //if (objDataSet.Tables[0].Rows[0]["User_Id"].ToString() == "1" || objDataSet.Tables[0].Rows[0]["User_Id"].ToString() == "2" || objDataSet.Tables[0].Rows[0]["User_Id"].ToString() == "3") if (Session["RedirectURL"] == null) { Response.Redirect("Admin/frmHome.aspx", false); } else { Response.Redirect(Session["RedirectURL"].ToString(), false); Session["RedirectURL"] = null; } } else { ShowNotification("Login", "Sorry! EmailId already exist Please use another one..!", NotificationType.error); } } catch (Exception Ex) { } }
protected void btnRegister_Click(object sender, EventArgs e) { try { string regexPattern = @"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$"; bool chk = new Regex(regexPattern, RegexOptions.IgnoreCase).IsMatch(txtEmailId.Text.Trim()); //string fud = fupImage.FileName; if (chk == true && txtName.Text.Trim() != "" && txtMobileNumber.Text.Trim() != "" && txtEmailId.Text.Trim() != "" && txtAddress.Text.Trim() != "" && ddlDay.SelectedIndex != 0 && ddlMonth.SelectedIndex != 0 && ddlYear.SelectedIndex != 0 && ddlCity.SelectedIndex != 0) { Admin_User objAdmin_User = new Admin_User(); objAdmin_User.Address = txtAddress.Text.Trim(); objAdmin_User.EmailId = txtEmailId.Text.Trim(); objAdmin_User.Mobile = txtMobileNumber.Text.Trim(); objAdmin_User.Name = txtName.Text.Trim(); objAdmin_User.DOB = Convert.ToDateTime(ddlMonth.SelectedValue.ToString() + "/" + ddlDay.SelectedValue.ToString() + "/" + ddlYear.SelectedItem.ToString()); objAdmin_User.RegisterId = 0; objAdmin_User.DumpEmailId = ""; objAdmin_User.Img = ""; objAdmin_User.CityId = Convert.ToInt32(ddlCity.SelectedValue.ToString()); objAdmin_User.UserId = 0; objAdmin_User.CreatedDate = DateTime.Now.AddHours(Connection.SetHours); string Gender = ""; if (rdbMale.Checked) { Gender = "Male"; } else if (rdbFemale.Checked) { Gender = "Female"; } else { Gender = "Others"; } objAdmin_User.Gender = Gender;//rdbMale.Checked ? "Male" : "Female"; objAdmin_User.DumpCityId = "0"; DataSet objDataSet = Admin_User.Send_User_To_DB(objAdmin_User); if (objDataSet.Tables[0].Rows[0][1].ToString() == "1") { //if (fud != "") // fupImage.SaveAs(Server.MapPath("~/User_Photos/") + "Img_" + objDataSet.Tables[0].Rows[0][0].ToString() + ".jpg"); DataSet objDataSetChk = MasterCode.RetrieveQuery("Select Email,SMS from tbl_Settings where Form_Settings='Register'"); if (objDataSetChk.Tables[0].Rows[0]["Email"].ToString() == "True") { SendEmail.createEmailBody(txtName.Text, txtEmailId.Text, txtMobileNumber.Text.Trim(), txtEmailId.Text, objDataSet.Tables[0].Rows[0]["Password"].ToString(), @"RegisterTemplate.html"); ShowNotification("User Registered", "Successfully..", NotificationType.success); } if (objDataSetChk.Tables[0].Rows[0]["SMS"].ToString() == "True") { //message = "Dear Customer kindly pay your monthly bill amount Rs. " + dgvList.Rows[i].Cells[6].Value + "/- Ignore if paid. Thanks&Regards Surendra"; //string baseURL = "http://mobicomm.dove-sms.com/mobicomm/submitsms.jsp?user=SIMPLE1&key=809e3aa368XX&mobile=" + dgvList.Rows[i].Cells[4].Value + "&message='" + message + "'&senderid=alerts&accusage=1"; //client.OpenRead(baseURL); //Your user name string user = "******"; //Your authentication key string key = "809e3aa368XX"; //Multiple mobiles numbers separated by comma string mobile = txtMobileNumber.Text.Trim(); //Sender ID,While using route4 sender id should be 6 characters long. string senderid = "SIMPLE"; //Your message to send, Add URL encoding here. string message = HttpUtility.UrlEncode("Congratulations! your successfully registered in NScreens.com & username: "******" Password: "******"Password"].ToString() + " "); //Prepare you post parameters StringBuilder sbPostData = new StringBuilder(); sbPostData.AppendFormat("user={0}", user); sbPostData.AppendFormat("&key={0}", key); sbPostData.AppendFormat("&mobile={0}", mobile); sbPostData.AppendFormat("&message={0}", message); sbPostData.AppendFormat("&senderid={0}", senderid); sbPostData.AppendFormat("&accusage={0}", "1"); try { //Call Send SMS API string sendSMSUri = "http://mobicomm.dove-sms.com/mobicomm/submitsms.jsp?"; //Create HTTPWebrequest HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create(sendSMSUri); //Prepare and Add URL Encoded data UTF8Encoding encoding = new UTF8Encoding(); byte[] data = encoding.GetBytes(sbPostData.ToString()); //Specify post method httpWReq.Method = "POST"; httpWReq.ContentType = "application/x-www-form-urlencoded"; httpWReq.ContentLength = data.Length; using (Stream stream = httpWReq.GetRequestStream()) { stream.Write(data, 0, data.Length); } //Get the response HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string responseString = reader.ReadToEnd(); //Close the response reader.Close(); response.Close(); } catch (SystemException ex) { //MessageBox.Show(ex.Message.ToString()); } } txtName.Text = ""; txtMobileNumber.Text = ""; txtEmailId.Text = ""; txtAddress.Text = ""; } else if (objDataSet.Tables[0].Rows[0][1].ToString() == "-5") { ShowNotification("User Registration", "EmailId Already existed..!", NotificationType.error); } } else { ShowNotification("User Registration", "Please fill all fields..!", NotificationType.error); } } catch (Exception Ex) { } }