protected void btnback_Click(object sender, EventArgs e) { string qs = hfDistId.Value + "$" + hfLbId.Value + "$" + hfWard.Value + "$" + hfLbTyp.Value; qs = cc.DESEncrypt(qs); Response.Redirect("frmDiscrepancy.aspx?data=" + qs + ""); }
//Change the Password for particular user public void ChangePassword() { bool flag = false; try { urUserRegBLLObj.usrUserId = Convert.ToString(Session["User"]); urUserRegBLLObj.usrPassword = cc.DESEncrypt(txtOldPasswod.Text); urUserRegBLLObj.usrChangePassword = cc.DESEncrypt(txtConfirmNewPassword.Text); status = urUserRegBLLObj.BLLUserRegistrationChangePassword(urUserRegBLLObj); if (status > 0) { List <UserRegistrationBLL> usrInfoList = new List <UserRegistrationBLL>(); DataTable dtUserInfoList = urUserRegBLLObj.BLLGetUserDetails(urUserRegBLLObj); DataRow dRowUserInfoList = dtUserInfoList.Rows[0]; //string myMobileNo = "91" + Convert.ToString(dRowUserInfoList["usrMobileNo"]); string myMobileNo = Convert.ToString(dRowUserInfoList["usrMobileNo"]); string myPassword = cc.DESDecrypt(Convert.ToString(dRowUserInfoList["usrPassword"])); string myName = Convert.ToString(dRowUserInfoList["usrFirstName"]); // string mPassword = cc.DESDecrypt(urUserRegBLLObj.usrChangePassword); int result = onlineexam.UpdatePwd(myMobileNo, Convert.ToString(dRowUserInfoList["usrPassword"])); string sendFrom = "COM2MYCT"; string passwordMessage = "Dear " + myName + ",Your a/c password changed for come2mycity.com.New Password is: " + myPassword + " " + cc.AddSMS(myMobileNo); // ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Password changed')", true); //string msg = "Your New Password is: " + cc.DESDecrypt(urUserRegBLLObj.usrChangePassword); flag = cc.SendMessageImp1(sendFrom, myMobileNo, passwordMessage); flag = cc.SendMessage1(sendFrom, myMobileNo, passwordMessage); if (flag == true) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Password Changed Successfully...Password will be devlivered shortly on your registered Mobile No.')", true); // System.Windows.Forms.MessageBox.Show("Password Changed Successfully...Password will be devlivered shortly on your registered Mobile No.", "Come2MyCity"); // Response.Redirect("MyProfile.aspx"); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Password Changed Successfully...Password will be devlivered shortly on your registered Mobile No.')", true); //ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Password Changed Successfully But Message is not sent')", true); // System.Windows.Forms.MessageBox.Show("Password Changed Successfully But Message is not sent", "Come2MyCity"); } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Password Not changed')", true); // System.Windows.Forms.MessageBox.Show("Password Not changed", "Come2MyCity"); } } catch (Exception ex) { //throw ex; } ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Password Not changed')", true); }
public void ChangeRegisteredMobileNo() { try { urUserRegBLLObj.usrUserId = Convert.ToString(Session["User"]); urUserRegBLLObj.usrMobileNo = txtNewMobileNo.Text; Random rnd = new Random(); urUserRegBLLObj.usrPassword = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); string MobileNo = Convert.ToString(txtNewMobileNo.Text); if (MobileNo.Length == 10) { status = urUserRegBLLObj.BLLIsExistUserRegistrationInitial(urUserRegBLLObj); if (status == 0) { txtNewMobileNo.Text = ""; txtNewMobileNo.Focus(); ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Given New Mobile Number already registered in come2mycity.com')", true); // System.Windows.Forms.MessageBox.Show("Given New Mobile Number already registered in come2mycity.com", "Come2MyCity"); } else { status = urUserRegBLLObj.BLLUserRegisteredMobileNoUpdate(urUserRegBLLObj); Response.Write("<script>alert('Mobile number Changed.Login Again')</script>"); if (status > 0) { string senderId = "COM2MYCT"; //string myMobileNo = "91" + urUserRegBLLObj.usrMobileNo; string myMobileNo = urUserRegBLLObj.usrMobileNo; string myPassword = cc.DESDecrypt(urUserRegBLLObj.usrPassword); string myName = Convert.ToString(Session["userName"]); string passwordMessage = "Dear " + myName + ",Password for ur Login with your New Registered Mobile No is:" + myPassword + " " + cc.AddSMS(myMobileNo); cc.SendMessage1(senderId, myMobileNo, passwordMessage); cc.SendMessageImp1(senderId, myMobileNo, passwordMessage); // ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Mobile number Changed.Login Again')", true); Response.Write("<script>alert('Mobile number Changed.Login Again')</script>"); // System.Windows.Forms.MessageBox.Show("Mobile number Changed Successfully.Login Again", "Come2MyCity"); Response.Redirect("Logout.aspx"); } else { // ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Mobile number Not changed.')", true); Response.Write("<script>alert('Mobile number Not changed.')</script>"); // System.Windows.Forms.MessageBox.Show("Mobile number Not changed.Please try again", "Come2MyCity"); txtNewMobileNo.Text = ""; } } } else { Response.Write("<script>alert('please Enter the 10 Disit mobile No..!')</script>"); } } catch (Exception ex) { // throw ex; } }
protected void lnkShow_Click(object sender, EventArgs e) { string moNo = string.Empty; LinkButton lbtnShow = (LinkButton)sender; moNo = lbtnShow.CommandArgument; Response.Redirect("~/Reports/frmAcceptExpenseMain.aspx?mNo=" + cc.DESEncrypt(moNo) + ""); //cmd = new SqlCommand(); //DataSet dsExpe = new DataSet(); //cmd.Connection = con; //cmd.CommandText = "uspCandidateWiseDailyExp"; //cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@mobileNo1", SqlDbType.NVarChar).Value = moNo; //da = new SqlDataAdapter(cmd); //da.Fill(dsExpe); //int dsCnt = dsExpe.Tables[0].Rows.Count; //if (dsCnt > 0) //{ // gvCandidateDailyEx.DataSource = dsExpe.Tables[0]; // gvCandidateDailyEx.DataBind(); //} //else //{ // gvCandidateDailyEx.DataSource = dsExpe.Tables[0]; // gvCandidateDailyEx.DataBind(); //} }
//---------------------------------------------------User Registration--------------------------------------------------------------------------- #region UserRegistration public string UserRegistration(string Username, string MobileNo, string usrEmailId, string usrGender, string Age) { string userid = ""; try { //string[] FullName = Username.Split(' '); //string fname = Convert.ToString(FullName[0].Trim()); //string lname = Convert.ToString(FullName[1].Trim()); userid = System.Guid.NewGuid().ToString(); Random rnd = new Random(); string pwd = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); string Sql = "insert into usermaster(usrUserId,usrFirstName,usrMobileNo,usrPassword,usrEmailId,usrGender,Age)" + " values('" + userid + "','" + Username + "','" + MobileNo + "','" + pwd + "','" + usrEmailId + "','" + usrGender + "','" + Age + "')"; int ID = cc.ExecuteNonQuery(Sql); if (ID == 1) { string myPassword = cc.DESDecrypt(pwd); string passwordMessage = "Dear " + Username + ", Password for ur First Login is " + myPassword + " " + cc.AddSMS(MobileNo); int smslength = passwordMessage.Length; cc.TransactionalSMSCountry("Website", MobileNo, passwordMessage, smslength, 7); } } catch (Exception ex) { throw ex; } return(userid); }
public string NewRegistration(string registrationString) //Want to change in this service as enc and dec algo { try { if (registrationString != null && !String.IsNullOrEmpty(registrationString) && !String.IsNullOrWhiteSpace(registrationString)) { String[] dataArray = registrationString.Split(new char[] { '*' }); if (dataArray.Length == 8) { //insert into database Random otpGenerator = new Random(); string otpNumber = otpGenerator.Next(1000, 9999).ToString(); RegistrationDAL registrationDal = new RegistrationDAL(); CommonCode commonCode = new CommonCode(); // string password = commonCode.DESEncrypt(dataArray[3]); //string password = dataArray[3]; string password = dataArray[3]; string userName = dataArray[2]; userName = EncryptDecrypt.DecodeAndDecrypt(userName); password = EncryptDecrypt.DecodeAndDecrypt(password); string pw = password.Substring(0, password.Length - 12); password = commonCode.DESEncrypt(pw); string dt1 = userName.Substring(userName.Length - 12); userName = userName.Substring(0, userName.Length - 12); string retVal = objenc.DateTimeDec(dt1); if (retVal == "0") { return(CommonCode.SQL_ERROR.ToString()); } //string result = registrationDal.newRegistration(dataArray[0], dataArray[1], dataArray[2], password, otpNumber, dataArray[4], dataArray[5], dataArray[6], dataArray[7]); string result = registrationDal.newRegistration(dataArray[0], dataArray[1], userName, password, otpNumber, dataArray[4], dataArray[5], dataArray[6], dataArray[7]); string[] r = result.Split(new Char[] { '*' }); if (r[0] == CommonCode.OK.ToString()) { //string message = "Dear " + dataArray[2] + " thanks to Register your Voter Profile in True Voter app. OTP for profile confirmation is " + otpNumber + ""; string message = "Dear " + userName + " thanks to Register your Voter Profile in True Voter app. OTP for profile confirmation is " + otpNumber + ""; SendSMS(dataArray[1], message); } return(result.ToString()); } else { return(CommonCode.WRONG_INPUT.ToString()); } } return(CommonCode.WRONG_INPUT.ToString()); } catch (Exception) { return(CommonCode.ERROR.ToString()); } }
protected void lnkShow_Click(object sender, EventArgs e) { string moNo = string.Empty; LinkButton lbtnShow = (LinkButton)sender; moNo = lbtnShow.CommandArgument; Response.Redirect("~/Reports/frmaddExpenseByOfficerTwo.aspx?mNo=" + cc.DESEncrypt(moNo) + ""); }
protected void lbtnGetDetails_Click(object sender, EventArgs e) { LinkButton l = (LinkButton)sender; string mNo = l.CommandArgument.ToString(); string qs = mNo + "$" + hfDistId.Value + "$" + hfLbId.Value + "$" + hfWard.Value + "$" + hfLbTyp.Value; qs = cc.DESEncrypt(qs); Response.Redirect("frmDiscrepancyDetails.aspx?data=" + qs + ""); }
protected void gvToday_RowCommand(object sender, GridViewCommandEventArgs e) { string mobileId = Convert.ToString(e.CommandArgument); string Sql = " select tm.SchoolCode from UDISE_TeacherMaster as tm " + " inner join UserMaster as um on um.usrUserId=tm.junior_id " + " where um.usrMobileNo=N'" + Convert.ToString(mobileId) + "'"; string schoolcode = cc.ExecuteScalar(Sql); mobileId = cc.DESEncrypt(mobileId); schoolcode = cc.DESEncrypt(schoolcode); if ((mobileId != "" || mobileId != "null") && (schoolcode != "" || schoolcode != "null")) { if (Convert.ToString(e.CommandName) == "Show") { Response.Redirect("~/MarketingAdmin/SchoolAttendence.aspx?mn=" + mobileId + "&sc=" + schoolcode + ""); } } }
public string GetRegisterToMahatet(string MobileNo, string Fname, string Lname, string address, string pincode, string EmailId) { int status, smslength; string id = ""; try { UserRegistrationBLL balobj = new UserRegistrationBLL(); CommonCode cc = new CommonCode(); balobj.usrFirstName = Fname; balobj.usrLastName = Lname; balobj.usrMobileNo = MobileNo; balobj.usrAddress = address; balobj.usrPIN = pincode; balobj.usrEmailId = EmailId; status = balobj.BLLIsExistUserRegistrationInitial(balobj); if (status > 0) { balobj.usrUserId = System.Guid.NewGuid().ToString(); Random rnd = new Random(); balobj.usrPassword = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); status = balobj.BLLInsertUserRegistrationInitial(balobj); if (status > 0) { id = balobj.usrUserId; string myMobileNo = balobj.usrMobileNo; string myPassword = cc.DESDecrypt(balobj.usrPassword); string myName = balobj.usrFirstName; string passwordMessage = "Welcome " + myName + ", to www.mahatet.co.in,Password for ur First Login is " + myPassword + " " + cc.AddSMS(myMobileNo); smslength = passwordMessage.Length; //cc.SendMessageMahatetSMS("Mahatet", myMobileNo, passwordMessage, smslength); cc.TransactionalSMSCountry("Mahatet", myMobileNo, passwordMessage, smslength, 20); } } else { DataSet ds = new DataSet(); ds = balobj.BLLGetUserIdPassword(balobj); string name = Convert.ToString(ds.Tables[0].Rows[0]["FullName"]); string password = Convert.ToString(ds.Tables[0].Rows[0]["usrPassword"]); password = cc.DESDecrypt(password); id = Convert.ToString(ds.Tables[0].Rows[0]["usrUserid"]); string passwordMessage = "Welcome " + name + ", to www.mahatet.co.in,Password is " + password + " " + cc.AddSMS(MobileNo); smslength = passwordMessage.Length; //cc.SendMessageMahatetSMS("Mahatet", MobileNo, passwordMessage, smslength); cc.TransactionalSMSCountry("Mahatet", MobileNo, passwordMessage, smslength, 20); } } catch (Exception ex) { } // Insert into [Come2MyCityDB].[dbo].[sendercode](ProjectName,Code)values('Mahatet',20) return(id); }
protected void btnBack_Click(object sender, EventArgs e) { try { string qs = hfDistId.Value + "$" + hfLbId.Value + "$" + hfWard.Value + "$" + hfLbTyp.Value + "$" + hfDistId.Value; qs = cc.DESEncrypt(qs); Response.Redirect("frmDiscrepancy.aspx?data=" + qs + ""); //Response.Redirect("frmDiscrepancyDetails.aspx",); } catch (Exception) { } }
public string GetRegisterRecord(string MobileNo, string Fname, string Lname, string address, string pincode, string status) { int i, smslength; string id = ""; UserRegistrationBLL balobj = new UserRegistrationBLL(); CommonCode cc = new CommonCode(); balobj.usrFirstName = Fname; balobj.usrLastName = Lname; balobj.usrMobileNo = MobileNo; balobj.usrAddress = address; balobj.usrPIN = pincode; i = balobj.BLLIsExistUserRegistrationInitial(balobj); if (i > 0) { balobj.usrUserId = System.Guid.NewGuid().ToString(); Random rnd = new Random(); balobj.usrPassword = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); i = balobj.BLLInsertUserRegistrationInitial(balobj); if (i > 0) { id = balobj.usrUserId; string myMobileNo = balobj.usrMobileNo; string myPassword = cc.DESDecrypt(balobj.usrPassword); string myName = balobj.usrFirstName; string passwordMessage = "Welcome " + myName + ", to www.exam.myct.in,for ur First Login Username="******" & Password is " + myPassword + " " + cc.AddSMS(myMobileNo); smslength = passwordMessage.Length; cc.TransactionalSMSCountry("OnlineExam", myMobileNo, passwordMessage, smslength, 22); } } else { if (status == "1") { DataSet ds = new DataSet(); ds = balobj.BLLGetUserIdPassword(balobj); if (ds.Tables[0].Rows.Count > 0) { string name = Convert.ToString(ds.Tables[0].Rows[0]["FullName"]); string password = Convert.ToString(ds.Tables[0].Rows[0]["usrPassword"]); password = cc.DESDecrypt(password); id = Convert.ToString(ds.Tables[0].Rows[0]["usrUserid"]); string passwordMessage = "Welcome " + name + ", to www.exam.myct.in,Password for ur First Login is " + password + " " + cc.AddSMS(MobileNo); smslength = passwordMessage.Length; cc.TransactionalSMSCountry("OnlineExam", MobileNo, passwordMessage, smslength, 22); } } } return(id); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (ddlGroups.SelectedValue != "0") { string groupId = ddlGroups.SelectedValue; string qs = mob + "$" + groupId; qs = cc.DESEncrypt(qs); Response.Redirect("rptGroupExpense.aspx?data=" + qs + ""); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Please Select Group')", true); } }
protected void lbtnGetDetails_Click(object sender, EventArgs e) { try { LinkButton l = (LinkButton)sender; string mNo = l.CommandArgument.ToString(); string qs = mNo + "$" + hfDistId.Value + "$" + hfLbId.Value + "$" + hfLbTyp.Value; qs = cc.DESEncrypt(qs); Response.Redirect("frmNoticeDetails.aspx?data=" + qs + ""); } catch (Exception) { throw; } }
//------------------------------------------------------User Registration To MYCT------------------------------------------------------------------ #region RegToUserMaster public string RegToUserMaster(string MobileNo, string Fname, string Lname, string address, string pincode, string strDevId) { string uid = String.Empty; string str = "select usrUserId from [Come2myCityDB].[dbo].[UserMaster] where usrMobileNo='" + MobileNo + "' "; uid = cc.ExecuteScalar(str); if (uid == "" || uid == null) { string newUid = System.Guid.NewGuid().ToString(); Random rnd = new Random(); string Password = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); cmd.Parameters.AddWithValue("@usrMobileNo", MobileNo); cmd.Parameters.AddWithValue("@usrFirstName", Fname); cmd.Parameters.AddWithValue("@usrLastName", Lname); cmd.Parameters.AddWithValue("@usrPassword", Password); cmd.Parameters.AddWithValue("@usrAddress", address); cmd.Parameters.AddWithValue("@usrPIN", pincode); cmd.Parameters.AddWithValue("@strDevId", strDevId); cmd.Parameters.AddWithValue("@usrUserId", newUid); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "uspUserMasterInsert"; cmd.Connection = con; if (cmd.Connection.State == ConnectionState.Closed) { cmd.Connection.Open(); } int i = cmd.ExecuteNonQuery(); //----------Send SMS--------------------- if (i > 0) { string myMobileNo = MobileNo; string myPassword = cc.DESDecrypt(Password); string myName = Fname; string passwordMessage = "Welcome " + myName + ",for ur First Login for MyCt Password Username="******" & Password is " + myPassword + " " + cc.AddSMS(myMobileNo); int smslength = passwordMessage.Length; cc.TransactionalSMSCountry("OnlineExam", myMobileNo, passwordMessage, smslength, 22); } uid = newUid; } return(uid); }
protected void btnUpdate_Click(object sender, EventArgs e) { UserBLL user = new UserBLL(); user.LoginId = Convert.ToString(Session["LoginId"]); if (txtUserName.Text == "") { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Enter user Name.')", true); } else if (txtPassword.Text == "") { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Password should not be blank.')", true); } else if (txtPassword.Text != txtRePassword.Text) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Both Password should be same.')", true); } else { try { CommonCode cc = new CommonCode(); user.UserName = txtUserName.Text.ToString(); user.Password = cc.DESEncrypt(txtPassword.Text.ToString()); user.ContactNo = txtContactNo.Text.ToString(); user.Address = txtAddress.Text.ToString(); user.Role = 0; user.CompanyId = 0; user.DOJ = Convert.ToDateTime("01-Apr-2011"); int status = user.UpdateOwnDetails(user); if (status == 1) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Updated Successfully.')", true); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Updated Successfully.')", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Updated Successfully.')", true); } } }
public int Addnew(string fname, string lname, string mobileno) { try { string userid = System.Guid.NewGuid().ToString(); Random rnd = new Random(); string pwd = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); string Sql = "insert into usermaster(usrUserId,usrFirstName,usrLastName,usrMobileNo,usrPassword)" + " values('" + userid + "','" + fname + "','" + lname + "','" + mobileno + "','" + pwd + "')"; int ID = cc.ExecuteNonQuery(Sql); return(ID); } catch (Exception ex) { throw ex; } }
public string RegisterUser(string FirstName, string lastName, string MobileNo) { int ID; try { string sql = "select usrPassword from usermaster where usrMobileNo= '" + MobileNo + "' "; string already = cc.ExecuteScalar(sql);// check this user already register if (already == "" || already == null) { string userid = System.Guid.NewGuid().ToString(); Random rnd = new Random(); pwd = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); string Sql = "insert into usermaster(usrUserId,usrFirstName,usrLastName,usrMobileNo,usrPassword)" + " values('" + userid + "','" + FirstName + "','" + lastName + "','" + MobileNo + "','" + pwd + "')"; ID = cc.ExecuteNonQuery(Sql); if (ID == 1) { pwd = cc.DESDecrypt(pwd); return(pwd); } else { string error = "error"; return(error); } } else { //string sql1 = "select usrPassword from usermaster where usrMobileNo= '" + mobileno + "' "; //pwd = cc.ExecuteScalarCt1(sql1);// check this user already register pwd = cc.DESDecrypt(already); } } catch (Exception ex) { throw ex; } return(pwd); }
public void Autenticateuser() { try { // ds = cc.getLoginDetails(txtUserId.Text.ToString(), cc.DESEncrypt(txtPassword.Text.ToString())); CTdll.UserLogin ul = new CTdll.UserLogin(); sc = ul.getLoggedIn(txtUserId.Text.ToString(), cc.DESEncrypt(txtPassword.Text.ToString()), ConfigurationManager.AppSettings["ConnectionString"], "Login"); Session["SC"] = sc; if (sc != null) { Session["User"] = Convert.ToString(sc.UserId); //Session["MobileNoN"] = Convert.ToString(ds.Tables[0].Rows[0]["MobileNo"]); Session["UserFirstNameN"] = Convert.ToString(sc.UserFName); Session["UserLastNameN"] = Convert.ToString(sc.UserLName); Session["UserMiddleName"] = Convert.ToString(sc.UserMName); Session["CityNameN"] = Convert.ToString(sc.CityName); Session["City"] = Convert.ToString(sc.CityId); Session["Mobile"] = Convert.ToString(sc.Mobile); Session["lastLogin"] = Convert.ToString(sc.LastLogin); if (Convert.ToString(sc.UserId).Trim() == "") { lblMsg.Text = "Invalid User"; ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Name or Password is Incorrect ...Please try again')", true); } else { Response.Redirect("html/UserInfo.aspx"); } } else { lblMsg.Text = "Invalid User"; ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Name or Password is Incorrect ...Please try again')", true); } } catch (Exception ex) { string msg = ex.Message; lblMsg.Text = "Invalid User"; ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Name or Password is Incorrect...Please try again')", true); } }
public DataTable UserLoginAuthenticate(string MobileNo, string Password) { DataSet ds = new DataSet(); CommonCode cc = new CommonCode(); UserRegistrationBLL balobj = new UserRegistrationBLL(); balobj.usrMobileNo = MobileNo; int roleid = balobj.BLLGetUserRoleId(balobj); balobj.usrPassword = cc.DESEncrypt(Password); ds = cc.getLoginDetails(MobileNo, balobj.usrPassword); DataTable dt = ds.Tables[0]; dt.Columns.Add("Roleid", typeof(Int32)); foreach (DataRow dr in dt.Rows) { dr["Roleid"] = roleid; dt = dr.Table; } return(dt); }
public bool RegisterUser(string TeacherMobileNo, string FirstName, string lastName, string Address, string PIN, string email) { bool Flag = false; string usrUserId = System.Guid.NewGuid().ToString(); Random rnd = new Random(); string usrPassword = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); string sql = "insert into UserMaster(usrUserId,usrMobileNo,usrAddress,usrPassword,usrFirstName,usrLastName,usrPIN,usrEmailId) " + " values('" + usrUserId + "','" + TeacherMobileNo + "','" + Address + "','" + usrPassword.ToString() + "','" + FirstName + "','" + lastName + "','" + PIN + "','" + email + "') "; int ststus = cc.ExecuteNonQuery(sql); if (ststus > 0) { Flag = true; return(Flag); } else { Flag = false; return(Flag); } }
//------------------------------------------------------User Registration To MYCT------------------------------------------------------------------ #region GetRegistration public string GetRegisterRecord(string MobileNo, string Fname, string Lname, string address, string pincode, string strDevId) { int i, smslength; string id = ""; DataSet ds = new DataSet(); try { UserRegistrationBLL balobj = new UserRegistrationBLL(); CommonCode cc = new CommonCode(); balobj.usrFirstName = Fname; balobj.usrLastName = Lname; balobj.usrMobileNo = MobileNo; balobj.usrAddress = address; balobj.usrPIN = pincode; balobj.StrDevId = strDevId; i = balobj.BLLIsExistUserRegistrationInitial(balobj);//check user is exist or not if i = 0 then already exist if (i > 0) { balobj.usrUserId = System.Guid.NewGuid().ToString(); Random rnd = new Random(); balobj.usrPassword = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); i = balobj.BLLInsertUserRegistrationInitial(balobj); if (i > 0) { id = balobj.usrUserId; string myMobileNo = balobj.usrMobileNo; string myPassword = cc.DESDecrypt(balobj.usrPassword); string myName = balobj.usrFirstName; string passwordMessage = "Welcome " + myName + ",for ur First Login Username="******" & Password is " + myPassword + " " + cc.AddSMS(myMobileNo); smslength = passwordMessage.Length; cc.TransactionalSMSCountry("OnlineExam", myMobileNo, passwordMessage, smslength, 22); //------------------------------ For Dublicate IMEI number.................... string sql3 = "select [usrMobileNo] from usermaster where strDevId = '" + strDevId + "'";//takes all mobile number who have same IMEI number ds = cc.ExecuteDataset(sql3); foreach (DataRow row in ds.Tables[0].Rows) { if (row[0].Equals(MobileNo)) { } else { string sql = "update usermaster set StrDevId = '0' where [usrMobileNo] ='" + row[0] + "' "; int j = cc.ExecuteNonQuery(sql); } } } } else { string sqlget = "select usrUserid from usermaster where usrMobileNo='" + MobileNo + "'";//geting userid of user id = cc.ExecuteScalar(sqlget); string sql2 = "select strDevId from usermaster where usrUserid='" + id + "' "; string str = cc.ExecuteScalar(sql2); if (str == "" || str == null || str == "0") // If IMEI no is null { string sql = "Update usermaster set StrDevId = '" + strDevId + "' where usrUserid ='" + id + "' "; //to add/update IMEI no's for old entries int j = cc.ExecuteNonQuery(sql); } string sql3 = "select [usrMobileNo] from usermaster where strDevId = '" + str + "'";//takes all mobile number who have same IMEI number ds = cc.ExecuteDataset(sql3); foreach (DataRow row in ds.Tables[0].Rows) { if (row[0].Equals(MobileNo)) { } else { string sql = "update usermaster set StrDevId = '0' where [usrMobileNo] ='" + row[0] + "' "; int j = cc.ExecuteNonQuery(sql); } } } } catch (Exception ex) { } return(id); }
public void Autenticateuser() { try { // ds = cc.getLoginDetails(txtUserId.Text.ToString(), cc.DESEncrypt(txtPassword.Text.ToString())); CTdll.UserLogin ul = new CTdll.UserLogin(); sc = ul.getLoggedIn(txtUserId.Text.ToString(), cc.DESEncrypt(txtPassword.Text.ToString()), ConfigurationManager.AppSettings["ConnectionString"], "Login"); Session["SC"] = sc; if (sc != null) { if (txtUserId.Text.Length == 10) { Session["User"] = Convert.ToString(sc.UserId); //Session["MobileNoN"] = Convert.ToString(ds.Tables[0].Rows[0]["MobileNo"]); Session["UserFirstNameN"] = Convert.ToString(sc.UserFName); Session["UserLastNameN"] = Convert.ToString(sc.UserLName); Session["UserMiddleName"] = Convert.ToString(sc.UserMName); Session["CityNameN"] = Convert.ToString(sc.CityName); Session["City"] = Convert.ToString(sc.CityId); Session["Mobile"] = Convert.ToString(sc.Mobile); Session["lastLogin"] = Convert.ToString(sc.LastLogin); Session["MobileNo"] = txtUserId.Text.ToString(); if (Convert.ToString(sc.UserId).Trim() == "") { lblMsg.Text = "Invalid User"; ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Name or Password is Incorrect ...Please try again')", true); } else { string sql = "select id from [DBCome2myct].[come2mycity].[DemoOnline] where userid='" + sc.UserId + "'"; string id = cc.ExecuteScalar(sql); if (id == "" || id == null) { sql = "insert into [DBCome2myct].[come2mycity].[DemoOnline](userid,status)values('" + sc.UserId + "','Active')"; int a = cc.ExecuteNonQuery(sql); } else { sql = "update [DBCome2myct].[come2mycity].[DemoOnline] set status='Active' where userid='" + sc.UserId + "'"; int a = cc.ExecuteNonQuery(sql); } string hostipadd = HttpContext.Current.Request.UserHostAddress; UserRegistrationBLL userRegBLL = new UserRegistrationBLL(); userRegBLL.usrUserId = Convert.ToString(Session["User"]); //userRegBLL.IPAddress = hostipadd; Response.Redirect("html/HomePage.aspx", false); ///changes done by pooja } } else { lblMsg.Text = "10 digit Mobile no"; ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Please enter the 10 disit mobile No....!')", true); } } else { lblMsg.Text = "Invalid User"; ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Name or Password is Incorrect ...Please try again')", true); } } catch (Exception ex) { string msg = ex.Message; lblMsg.Text = "Invalid User"; ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Name or Password is Incorrect...Please try again')", true); } }
public bool RegisterNew(string mno, string fnm, string lnm, string pin, string gr, string Add) { int status = 1; bool Check = false; //cqc.usrAltMobileNo=mno ; try { string usrmoNo = Convert.ToString(Session["Mobile"]); //textBox2.Text.ToString(); cqc.usrMobileNo = usrmoNo.ToString(); status = BLLIsExistUserRegistrationInitial(usrmoNo); if (status == 0) { status = BLLIsExistUserRegistrationInitial(mno); if (status == 0) { //DataTable dt1 = new DataTable(); string sql = "select usrUserId, usrFirstName,usrCityId from UserMaster where usrMobileNo='" + usrmoNo.ToString() + "'"; DataSet ds = new DataSet(); ds = ExecuteDataset(sql); //dt1 = ds.Tables[0]; string userId; string usrName = ""; int cityId; foreach (DataRow dr1 in ds.Tables[0].Rows) { userId = Convert.ToString(dr1["usrUserId"]); usrName = Convert.ToString(dr1["usrFirstName"]); cityId = Convert.ToInt32(dr1["usrCityId"]); cqc.frnrelUserId = userId; cqc.usrCityId = cityId; //ur.frnrelFrnRelName = usrName; //ur.frnrelRelation = "friend"; //ur.frnrelGroup = "1"; } string sql1 = "select usrUserId, usrFirstName from UserMaster where usrMobileNo='" + mno.ToString() + "'"; DataSet ds1 = new DataSet(); ds1 = ExecuteDataset(sql1); string FriId; string FriName; string[] RgArr = gr.Split('&'); if (RgArr.Length > 0) { for (int s = 0; s < RgArr.Length; s++) { foreach (DataRow dr2 in ds1.Tables[0].Rows) { FriId = Convert.ToString(dr2["usrUserId"]); FriName = Convert.ToString(dr2["usrFirstName"]); cqc.frnrelFriendId = FriId; cqc.frnrelFrnRelName = FriName; cqc.frnrelRelation = "friend"; cqc.frnrelGroup = RgArr[s].ToString(); } status = cqc.BLLInsertUserFriendRelative(cqc); } } else { foreach (DataRow dr2 in ds1.Tables[0].Rows) { FriId = Convert.ToString(dr2["usrUserId"]); FriName = Convert.ToString(dr2["usrFirstName"]); cqc.frnrelFriendId = FriId; cqc.frnrelFrnRelName = FriName; cqc.frnrelRelation = "friend"; cqc.frnrelGroup = "1"; } status = cqc.BLLInsertUserFriendRelative(cqc); } //if (status > 0) //{ // string SendTo = mno.ToString(); // string sendFrom = usrmoNo.ToString(); // string message = "I " + usrName + "(" + sendFrom.ToString() + ") added u in come2myCity.com to send free SMS." + cc.AdvMessage(); // //string passwordMessage = "I " + usrName + "(" + sendFrom.ToString() + ") of Abhinav B.Ed college Chikhli,Dist-Buldhana,added u as a Frnd 2 send free SMS frm come2mycity.com. For B.Ed admission help pl call me"; // cc.SendMessage1(sendFrom, SendTo, message); //} Check = true; } else { string sql3 = "select usrUserId, usrFirstName,usrCityId from UserMaster where usrMobileNo='" + cqc.usrMobileNo + "'"; DataSet ds = new DataSet(); ds = ExecuteDataset(sql3); //dt1 = ds.Tables[0]; string userId; string usrName = ""; int cityId = 0; string cityName = ""; foreach (DataRow dr1 in ds.Tables[0].Rows) { userId = Convert.ToString(dr1["usrUserId"]); usrName = Convert.ToString(dr1["usrFirstName"]); cityId = Convert.ToInt32(dr1["usrCityId"]); cqc.frnrelUserId = userId; cqc.usrCityId = cityId; //ur.frnrelFrnRelName = usrName; //ur.frnrelRelation = "friend"; //ur.frnrelGroup = "1"; } string sqlquery = "select cityName from CityMaster where cityId='" + Convert.ToString(cityId) + "'"; cityName = ExecuteScalar(sqlquery); cqc.usrUserId = System.Guid.NewGuid().ToString(); cqc.usrAddress = Convert.ToString(Add); cqc.usrMobileNo = mno.ToString(); cqc.usrFirstName = fnm.ToString(); cqc.usrLastName = lnm.ToString(); cqc.usrPIN = pin.ToString(); Random rnd = new Random(); cqc.usrPasssword = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); status = cqc.DALInsertUserRegistrationInitial(cqc); if (status > 0) { string sql1 = "select usrUserId, usrFirstName from UserMaster where usrMobileNo='" + cqc.usrMobileNo + "'"; DataSet ds1 = new DataSet(); ds1 = ExecuteDataset(sql1); //dt1 = ds.Tables[0]; string FriId; string FriName; string[] RgArr = gr.Split('&'); if (RgArr.Length > 0) { for (int s = 0; s < RgArr.Length; s++) { foreach (DataRow dr2 in ds1.Tables[0].Rows) { FriId = Convert.ToString(dr2["usrUserId"]); FriName = Convert.ToString(dr2["usrFirstName"]); cqc.frnrelFriendId = FriId; cqc.frnrelFrnRelName = FriName; cqc.frnrelRelation = "friend"; cqc.frnrelGroup = RgArr[s].ToString(); } status = cqc.BLLInsertUserFriendRelative(cqc); } } else { foreach (DataRow dr2 in ds1.Tables[0].Rows) { FriId = Convert.ToString(dr2["usrUserId"]); FriName = Convert.ToString(dr2["usrFirstName"]); cqc.frnrelFriendId = FriId; cqc.frnrelFrnRelName = FriName; cqc.frnrelRelation = "friend"; cqc.frnrelGroup = "1"; } } //string FriId; //string FriName; //foreach (DataRow dr2 in ds1.Tables[0].Rows) //{ // FriId = Convert.ToString(dr2["usrUserId"]); // FriName = Convert.ToString(dr2["usrFirstName"]); // cqc.frnrelFriendId = FriId; // cqc.frnrelFrnRelName = FriName; // cqc.frnrelRelation = "friend"; // cqc.frnrelGroup = "1"; //} status = cqc.BLLInsertUserFriendRelative(cqc); if (status > 0) { } string senderId = Convert.ToString(Session["Mobile"]); //textBox2.Text.ToString(); string sendThrugh = "myctin"; string myMobileNo = mno.ToString(); string myPassword = cc.DESDecrypt(cqc.usrPasssword); string myName = cqc.frnrelFrnRelName; string passwordMessage = "I " + usrName + "(" + senderId.ToString() + ") added u in city " + cityName + " on myct.in.U use it to send free SMS.Password for ur First Login is " + myPassword + " for www.muct.in"; string NewTraResp = "Dear " + fnm.ToString() + " I " + usrName.ToString() + "(" + senderId.ToString() + ") added u on www.myct.in as a friend to send imp messages. Ur login password is " + myPassword.ToString() + " thanks.Via www.myct.in"; cc.SendMessage1(sendThrugh, myMobileNo, NewTraResp); Check = true; } } } else { //NotRegisterMessageForLongCode(urRegistBll); } } catch (Exception ex) { throw ex; } return(Check); }
public string Registration(string AppMobileNo, string RefmobileNo, string strDevId, string strSimSerialNo, string keyword, string firstName, string lastName, string firmName, string address, string SchoolCode, string eMailId, string Role_Id, string pincode, string passcode, string latitude, string longitude, string state, string district, string Taluka, string userType, string DealerMobNo) { string returnStrig = string.Empty; try { Random rnd = new Random(); string Password = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); string regValue = string.Empty; Random rand = new Random(); string otpstr = Convert.ToString(rand.Next(1001, 9999)); string sqlSelect = "SELECT [RegId] FROM [TrueVoterDB].[dbo].[Logins](NOLOCK) WHERE [UserName] = '" + AppMobileNo + "' "; DataSet dsSelect = cc.ExecuteDataset(sqlSelect); if (dsSelect.Tables[0].Rows.Count > 0) { string sqlUpdate = "UPDATE [TrueVoterDB].[dbo].[Logins] SET [Name]=N'" + firstName + "',[LName]=N'" + lastName + "',[LATITUTE]='" + latitude + "',[LAGITUTE]='" + longitude + "',[EmailId]='" + eMailId + "',[UserType]='" + Role_Id + "',[ImeiNumber]='" + strDevId + "',[RefMobileNo]='" + RefmobileNo + "',[ModifyDate]='" + DateTime.Now.ToString("yyyy-MM-dd") + "',[ModifyBy]='" + AppMobileNo + "',[address]=N'" + address + "',[State]=" + state + ",[District]=" + district + ",[Taluka]=" + Taluka + ",[strSimSerialno]='" + strSimSerialNo + "' " + "WHERE [RegId] = '" + dsSelect.Tables[0].Rows[0]["RegId"].ToString() + "'"; cc.ExecuteNonQuery(sqlUpdate); #region if (Role_Id == "1") //VOTER { regValue = "PASS"; } else if (Role_Id == "2") //OFFICER { string sqlAdd = "SELECT * FROM [TrueVoterDB].[dbo].[tblAddRefferances](NOLOCK) WHERE [UserMobile] = '" + AppMobileNo + "' AND [RefMobile] = '" + RefmobileNo + "' AND [keyword] = 'JUNIOR' AND [isActive] = 'Active'"; DataSet dsAdd = cc.ExecuteDataset(sqlAdd); if (dsAdd.Tables[0].Rows.Count > 0)//is aprove asel tr msg not send here it get approval { string sqlIsppUpdate = "UPDATE [TrueVoterDB].[dbo].[Logins] SET [IsApproved] = 1 WHERE [UserName] = '" + AppMobileNo + "'"; cc.ExecuteNonQuery(sqlIsppUpdate); regValue = "PASS"; } else { string officerRole = string.Empty; officerRole = "Officer"; string msg = "I " + firstName + " " + lastName + " " + AppMobileNo + " installed TRUE VOTER for election purpose as " + officerRole + " role" + " Add me under you as Junior to give proper reporting thru TRUE VOTER"; cc.SMS(RefmobileNo, msg); regValue = "PASS"; } } else { // This Work is For Candidate add representative string sqlAdd = "SELECT * FROM [TrueVoterDB].[dbo].[tblAddRefferances](NOLOCK) WHERE [UserMobile] = '" + AppMobileNo + "' AND [RefMobile] = '" + RefmobileNo + "' AND [keyword] = 'REPRESENTATIVE' AND [isActive] = 'Active'"; DataSet dsAdd = cc.ExecuteDataset(sqlAdd); if (dsAdd.Tables[0].Rows.Count > 0) { string sqlIsppUpdate = "UPDATE [TrueVoterDB].[dbo].[Logins] SET [IsApproved] = 1 WHERE [UserName] = '" + AppMobileNo + "'"; cc.ExecuteNonQuery(sqlIsppUpdate); regValue = "PASS"; } else { string candidateRole = string.Empty; candidateRole = "Candidate";//"Representative"; string msg = "I " + firstName + " " + lastName + " " + AppMobileNo + " installed TRUE VOTER for election purpose as " + candidateRole + "" + " Add me under you as Representative to give proper reporting thru TRUE VOTER"; cc.SMS(RefmobileNo, msg); regValue = "PASS"; } } #endregion returnnew = SendOtpTrueVoter(AppMobileNo, otpstr, keyword, strDevId, RefmobileNo, firstName, Role_Id, regValue); //SEND OTP } else { regValue = objTrueReg.newRegistration(firstName, AppMobileNo, AppMobileNo, Password, otpstr, " ", lastName, latitude, longitude, eMailId, Role_Id, strDevId, RefmobileNo, strSimSerialNo, address, state, district, Taluka); returnnew = SendOtpTrueVoter(AppMobileNo, otpstr, keyword, strDevId, RefmobileNo, firstName, Role_Id, regValue); //SEND OTP } return(returnnew); } catch { return(returnStrig = "0"); } }
public string login(string userName, string password) { CommonCode cc = new CommonCode(); SqlCommand sqlCommand = new SqlCommand(); try { sqlCommand.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["TrueVoterConnectionString"].ConnectionString); sqlCommand.CommandText = "[TrueVoterDB].[dbo].[uspLogin]"; sqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter registrationSqlParameter = new SqlParameter("@regid", ""); registrationSqlParameter.Direction = ParameterDirection.Output; registrationSqlParameter.SqlDbType = SqlDbType.NVarChar; registrationSqlParameter.Size = 20; userName = EncryptDecrypt.DecodeAndDecrypt(userName); password = EncryptDecrypt.DecodeAndDecrypt(password); //changes on 25-10-2016 SM string pw = password.Substring(0, password.Length - 12); password = cc.DESEncrypt(pw); //line Coment of reject encription string dt1 = userName.Substring(userName.Length - 12); userName = userName.Substring(0, userName.Length - 12); string retVal = objenc.DateTimeDec(dt1); // password = password.Substring(0, password.Length - 10); if (retVal == "0") { return(CommonCode.SQL_ERROR.ToString()); } string temppass = password; CommonCode commoncode = new CommonCode(); //password = commoncode.DESEncrypt(password); double method error in voter login 25-10-2016 SqlParameter[] sqlParameter = new SqlParameter[] { new SqlParameter("@userName", userName), new SqlParameter("@pasword", password), registrationSqlParameter }; sqlCommand.Parameters.AddRange(sqlParameter); SqlParameter returnValue = sqlCommand.CreateParameter(); returnValue.SqlDbType = SqlDbType.Int; returnValue.Direction = ParameterDirection.ReturnValue; sqlCommand.Parameters.Add(returnValue); if (sqlCommand.Connection.State == ConnectionState.Closed) { sqlCommand.Connection.Open(); } sqlCommand.ExecuteNonQuery(); if (Convert.ToString(returnValue.Value) == "1") { //RegID Encription 28-10-2016 string concate1 = sqlCommand.Parameters["@regid"].Value.ToString(); string currentdate = System.DateTime.Now.ToString("ddMMyyHHmmss"); string RegiID = currentdate + "" + concate1; string regIdEnc = EncryptDecrypt.EncryptAndEncode(RegiID); //string regIdEnc = EncryptDecrypt.EncryptAndEncode(sqlCommand.Parameters["@regid"].Value.ToString()); Session["regId"] = sqlCommand.Parameters["@regid"].Value.ToString(); return(CommonCode.OK.ToString() + "*" + regIdEnc); //Session["regID"] = (sqlCommand.Parameters["@regid"].Value.ToString()); } else { return(CommonCode.SQL_ERROR.ToString()); } } catch (SqlException) { return(CommonCode.SQL_ERROR.ToString()); } catch (Exception) { return(CommonCode.ERROR.ToString()); } finally { sqlCommand.Connection.Close(); sqlCommand.Dispose(); } }
public XmlDocument Login(string Password, string MobileNo, string imeiNumber) //Change made 09.11.2016 { try { XmlDataDocument xmldata = new XmlDataDocument(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); CommonCode cc = new CommonCode(); string sqlQuery = string.Empty; MobileNo = EncryptDecrypt.DecodeAndDecrypt(MobileNo); Password = EncryptDecrypt.DecodeAndDecrypt(Password); string pw = Password.Substring(0, Password.Length - 12); Password = cc.DESEncrypt(pw); string dt1 = MobileNo.Substring(MobileNo.Length - 12); MobileNo = MobileNo.Substring(0, MobileNo.Length - 12); string retVal = objenc.DateTimeDec(dt1); //retVal = "1"; if (retVal == "0") { dt.Columns.Add(new DataColumn("NoRecord", typeof(int))); DataRow dr = dt.NewRow(); dr["NoRecord"] = "105"; dt.Rows.Add(dr); DataSet ds3 = new DataSet(); ds3.Tables.Add(dt); ds3.Tables[0].TableName = "NO"; xmldata = new XmlDataDocument(ds3); XmlElement xmlelement = xmldata.DocumentElement; return(xmldata); } //if (imeiNumber == "") //{ // sqlQuery = "SELECT [UserType] AS [typeOfUse_Id] " + // "FROM [TrueVoterDB].[dbo].[Logins] WHERE [UserName]='" + MobileNo + "' AND [Password]='" + Password + "'"; //} //else //{ sqlQuery = "SELECT [UserType] AS [typeOfUse_Id] " + "FROM [TrueVoterDB].[dbo].[Logins](NOLOCK) WHERE [UserName]='" + MobileNo + "' AND [Password]='" + Password + "' AND [ImeiNumber] = '" + imeiNumber + "'"; // } ds = cc.ExecuteDataset(sqlQuery); if (ds.Tables[0].Rows.Count > 0) { string roleId = ds.Tables[0].Rows[0]["typeOfUse_Id"].ToString(); if (roleId == "2") { sqlQuery = "SELECT [keyword]='TRUEVOTER',[ImeiNumber] AS [strDevId],[strSimSerialno] AS [strSimSerialNo],[Name] AS [firstName],[LName] AS [lastName],'0' AS [firmName], [MobileNo] AS [mobileNo], [address],[EmailId] AS [eMailId],[UserType] AS [typeOfUse_Id],[RefMobileNo] AS [RefMobileNo],[State],[District],[Taluka],[LATITUTE] AS [latitude],[LAGITUTE] AS [longitude] " + ",[IsApproved]=0,[usrMobileNumber],[DesignationId],[DesignationName],[LokingAfterId],[LokingAfterName],[LocalBodyId],[LocalBodyName],[refMobileNumber],[OfficerDistrictId],[Post],[AllocatedWard] " + "FROM [TrueVoterDB].[dbo].[Logins] INNER JOIN [TrueVoterDB].[dbo].[tblNewDataRegExtra] " + "ON [TrueVoterDB].[dbo].[Logins].[UserName] = [TrueVoterDB].[dbo].[tblNewDataRegExtra].[usrMobileNumber] WHERE [UserName]='" + MobileNo + "' AND [Password]='" + Password + "'"; } else { sqlQuery = "SELECT [keyword]='TRUEVOTER',[ImeiNumber] AS [strDevId],[strSimSerialno] AS [strSimSerialNo],[Name] AS [firstName],[LName] AS [lastName],'0' AS [firmName], " + "[MobileNo] AS [mobileNo], [address],[EmailId] AS [eMailId],[UserType] AS [typeOfUse_Id],[RefMobileNo] AS [RefMobileNo], " + "[State],[District],[Taluka],[LATITUTE] AS [latitude], [LAGITUTE] AS [longitude],[IsApproved]=0,[usrMobileNumber],[CandidateRole],[CandidateRoleName],[CandidateDistrictID], " + "[LocalBodyType] AS CandiLocalBodyType,[LocalBodyName] As CandiLocalBodyName,[WardNo] As CandiWard,[LocalBodyID] As CandiLocalBodyId,[AssemblyID] As CandiAssemblyId " + "FROM [TrueVoterDB].[dbo].[Logins] INNER JOIN [TrueVoterDB].[dbo].[tblNewDataCandi_Reg] " + "ON [TrueVoterDB].[dbo].[Logins].[UserName] = [TrueVoterDB].[dbo].[tblNewDataCandi_Reg].[usrMobileNumber] " + "WHERE [UserName]='" + MobileNo + "' AND [Password]='" + Password + "' AND [ImeiNumber] = '" + imeiNumber + "'"; } //if (imeiNumber != "") //{ DataSet dsWholeData = cc.ExecuteDataset(sqlQuery); xmldata = new XmlDataDocument(dsWholeData); //} //else //{ // xmldata = new XmlDataDocument(ds); //} XmlElement xmlele = xmldata.DocumentElement; return(xmldata); } else { dt.Columns.Add(new DataColumn("NoRecord", typeof(int))); DataRow dr = dt.NewRow(); dr["NoRecord"] = "105"; dt.Rows.Add(dr); DataSet ds3 = new DataSet(); ds3.Tables.Add(dt); ds3.Tables[0].TableName = "NO"; xmldata = new XmlDataDocument(ds3); XmlElement xmlelement = xmldata.DocumentElement; return(xmldata); } } catch { CommonCode commonCode = new CommonCode(); return(commonCode.ErrorXml(CommonCode.SQL_ERROR)); } }
public void Autenticateuser() { DataSet ds = new DataSet(); DataSet ds1 = new DataSet(); CommonCode cc = new CommonCode(); try { Session["MobileNumber"] = txtUserId.Text; ds = cc.getLoginDetails(txtUserId.Text.ToString(), cc.DESEncrypt(txtPassword.Text.ToString())); if (Convert.ToString(ds.Tables[0].Rows[0]["IsMarketingPerson"]) == "y" || Convert.ToString(ds.Tables[0].Rows[0]["IsMarketingPerson"]) == "Y") { if (ds.Tables[0].Rows.Count > 0) { SessionContext.UserId = Convert.ToString(ds.Tables[0].Rows[0]["UserId"]); string uid = Convert.ToString(ds.Tables[0].Rows[0]["UserId"]); //string sqlfullname = "select usrFirstName+''+usrLastName as FullName from usermaster where usrUserid='" + uid + "'"; //string FullName = cc.ExecuteScalar(sqlfullname); string FullName = Convert.ToString(ds.Tables[0].Rows[0]["FullName"]); string sqlcheck = "select MID from [Come2myCityDB].[come2mycity].[MartketingSubuser] where Uid1='" + uid + "'"; // DataSet dd=cc.ExecuteDataset(sqlcheck); string id = cc.ExecuteScalar(sqlcheck); //string roleid=Convert.ToString(dd.Tables[0].Rows[0]["RoeId"]); if (id == "" || id == null) { string sqlexe = "select roleid from [Come2myCityDB].[come2mycity].[AdminSubMarketingSubUser] where friendid='" + uid + "' and mainrole=1 "; string roleid = cc.ExecuteScalar(sqlexe); if (roleid != "") { //string sql12 = "select roleid from AdminSubMarketingSubUser where id='" + iduser + "' "; //string roleid = cc.ExecuteScalar(sql12); //string sql121 = "select roleid from SubMenuPermission where RoleName='" + rolename + "'"; //string roleid = cc.ExecuteScalar(sql121); Session["RoleId"] = roleid; //Session["RoleName"] = rolename; SessionContext.CityName = Convert.ToString(ds.Tables[0].Rows[0]["CityName"]); Session["MarketingUser"] = Convert.ToString(ds.Tables[0].Rows[0]["UserId"]); string s8 = Convert.ToString(ds.Tables[0].Rows[0]["UserId"]); Session["UserFirstNameN"] = Convert.ToString(ds.Tables[0].Rows[0]["FirstName"]); Session["UserLastNameN"] = Convert.ToString(ds.Tables[0].Rows[0]["LastName"]); Session["Name"] = FullName; Response.Redirect("../MarketingAdmin/Home.aspx"); } else { Response.Write("<script>alert('You are not member of myctin')</script>"); } } else { string sql = "select RoeId from [Come2myCityDB].[come2mycity].[MartketingSubuser] where Uid1='" + uid + "'"; string Role = cc.ExecuteScalar(sql); // string sql1 = "select RoleName from SubMenuPermission where RoleName='" + Role + "'"; // string RoleName1 = cc.ExecuteScalar(sql1); Session["RoleId"] = Role; string sql121 = "select RoleName from [Come2myCityDB].[come2mycity].[SubMenuPermission] where roleid='" + Role + "'"; string RoleName = cc.ExecuteScalar(sql121); Session["RoleName"] = RoleName; SessionContext.CityName = Convert.ToString(ds.Tables[0].Rows[0]["CityName"]); Session["MarketingUser"] = Convert.ToString(ds.Tables[0].Rows[0]["UserId"]); Session["UserFirstNameN"] = Convert.ToString(ds.Tables[0].Rows[0]["FirstName"]); Session["UserLastNameN"] = Convert.ToString(ds.Tables[0].Rows[0]["LastName"]); Session["Name"] = FullName; Response.Redirect("~/MarketingAdmin/Home.aspx", false); } } else { lblMsg.Text = "Invalid User credential"; Page.ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "alert('User Name or Password is Incorrect...Please try again')", true); } } else { lblMsg.Text = "Invalid User credential"; Page.ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "alert('You Have Not A Marketing Person')", true); } } catch (Exception ex) { string m = ex.Message; lblMsg.Text = "Invalid User credential"; Page.ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "alert('You Have Not A Marketing Person')", true); } }
public void UserRegistrationIntial() { try { if (txtFirstName.Text == "") { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Please Enter the Frist Name..!')", true); } else if (txtLastName.Text == "") { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Please Enter the Last Name..!')", true); } else if (txtMobileNumber.Text == "") { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Please Enter the Mobile No..!')", true); } else { urUserRegBLLObj.usrUserId = System.Guid.NewGuid().ToString(); urUserRegBLLObj.usrMobileNo = Convert.ToString(txtMobileNumber.Text); urUserRegBLLObj.usrAddress = Convert.ToString(txtAddress.Text); urUserRegBLLObj.usrFirstName = Convert.ToString(txtFirstName.Text); urUserRegBLLObj.usrLastName = Convert.ToString(txtLastName.Text); urUserRegBLLObj.usrStateId = Convert.ToInt32(Session["State"]); urUserRegBLLObj.usrDistrictId = Convert.ToInt32(Session["District"]); urUserRegBLLObj.usrCityId = Convert.ToInt32(Session["City"]); urUserRegBLLObj.usrGender = Convert.ToString(rdoGender.SelectedValue); urUserRegBLLObj.frnrelGroup = "1"; cityBLLObj.cityId = Convert.ToInt32(Session["City"]); //For Createing Password & Encrypting it Random rnd = new Random(); urUserRegBLLObj.usrPassword = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); status = urUserRegBLLObj.BLLIsExistUserRegistrationInitial(urUserRegBLLObj); if (status == 0) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User already Exists')", true); } else { status = urUserRegBLLObj.BLLInsertUserRegistrationInitial(urUserRegBLLObj); if (status > 0) { string myMobileNo = urUserRegBLLObj.usrMobileNo; string myPassword = cc.DESDecrypt(urUserRegBLLObj.usrPassword); string myName = urUserRegBLLObj.usrFirstName; string passwordMessage = "Dear " + myName + ", Password for ur First Login is " + myPassword + " " + cc.AddSMS(myMobileNo); int smslength = passwordMessage.Length; cc.TransactionalSMSCountry("Website", myMobileNo, passwordMessage, smslength, 7); ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Registration is Successful.Your Password will be delivered shortly on your mobile. Use it to Sign In your account.')", true); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('User Registration UnSuccessful')", true); } } ClearAll(); } } catch (Exception ex) { throw ex; } }
public void AddFriendByLongCodeF(UserRegistrationBLL ur, string userMobileWhoSendFriendReq, int grid) {//Mahesh: Use second parameter mobile for only send sms only, because at run time mobile number of sender change. try { string sender = ""; string joiner = ""; bool JoinAll = false; string flagMob = ur.usrAltMobileNo; status = urRegistBll.BLLIsExistUserRegistrationInitial(ur); if (status == 0) { status = urRegistBll.BLLIsExistUserRegistrationInitialByLc(ur); if (status == 0) { string sqlFlagStr = "select JoinFlag from userMaster where usrMobileNo='" + flagMob.ToString() + "'"; int jof = Convert.ToInt32(cc.ExecuteScalar(sqlFlagStr)); if (jof > 1) { JoinAll = true; ur.JoinFlagProp = Convert.ToString(jof); } //DataTable dt1 = new DataTable(); string sql = "select usrUserId, usrFirstName,usrCityId from UserMaster where usrMobileNo='" + ur.usrMobileNo + "'"; DataSet ds = new DataSet(); ds = cc.ExecuteDataset(sql); //dt1 = ds.Tables[0]; string userId; string usrName = ""; int cityId; foreach (DataRow dr1 in ds.Tables[0].Rows) { userId = Convert.ToString(dr1["usrUserId"]); usrName = Convert.ToString(dr1["usrFirstName"]); cityId = Convert.ToInt32(dr1["usrCityId"]); ur.frnrelFriendId = userId; ur.usrCityId = cityId; joiner = Convert.ToString(usrName); //ur.frnrelFrnRelName = usrName; //ur.frnrelRelation = "friend"; //ur.frnrelGroup = "1"; } string sql1 = "select usrUserId, usrFirstName from UserMaster where usrMobileNo='" + ur.usrAltMobileNo + "'"; DataSet ds1 = new DataSet(); ds1 = cc.ExecuteDataset(sql1); //dt1 = ds.Tables[0]; string FriId; string FriName; foreach (DataRow dr2 in ds1.Tables[0].Rows) { FriId = Convert.ToString(dr2["usrUserId"]); FriName = Convert.ToString(dr2["usrFirstName"]); ur.frnrelUserId = FriId; ur.frnrelFrnRelName = FriName; ur.frnrelRelation = "friend"; sender = Convert.ToString(FriName); //ur.frnrelGroup = "1"; //status = ur.BLLInsertUserFriendRelative(ur); ur.frnrelGroup = Convert.ToString(grid); } status = ur.BLLInsertUserFriendRelative(ur); if (status > 0) { string SendTo = ur.usrAltMobileNo; string sendFrom = ur.usrMobileNo; string message = "I " + usrName + "(" + sendFrom.ToString() + ") added u in www.myct.in to send SMS." + cc.AddSMS(SendTo); cc.SendMessage1(sendFrom, SendTo, message); if (JoinAll == true) { string resJoinAll = "Thanks " + joiner.ToString() + ", I " + sender.ToString() + "( " + SendTo.ToString() + " ) also added u on www.myct.in " + cc.AddSMS(sendFrom); cc.SendMessage1(SendTo, sendFrom, resJoinAll); } string changeFlagSql = "update come2mycity.test set FlagStatus = 0 where PK=" + Convert.ToInt32(ur.usrPKval); int pkchange = 0; pkchange = cc.ExecuteNonQuery(changeFlagSql); if (pkchange == 0) { pkchange = cc.ExecuteNonQuery(changeFlagSql); } } else { string SendTo = ur.usrAltMobileNo; string sendFrom = ur.usrMobileNo; string message = "Dear " + joiner.ToString() + " u already added " + sender.ToString() + " in www.myct.in to send SMS." + cc.AddSMS(sendFrom); cc.SendMessage1(SendTo, sendFrom, message); string changeFlagSql = "update come2mycity.test set FlagStatus = 0 where PK=" + Convert.ToInt32(ur.usrPKval); int pkchange = 0; pkchange = cc.ExecuteNonQuery(changeFlagSql); if (pkchange == 0) { pkchange = cc.ExecuteNonQuery(changeFlagSql); } } } else { string sql3 = "select usrUserId, usrFirstName,usrCityId from UserMaster where usrMobileNo='" + ur.usrMobileNo + "'"; DataSet ds = new DataSet(); ds = cc.ExecuteDataset(sql3); //dt1 = ds.Tables[0]; string userId; flagMob = ur.usrAltMobileNo; string usrName = ""; int cityId = 0; string cityName = ""; foreach (DataRow dr1 in ds.Tables[0].Rows) { userId = Convert.ToString(dr1["usrUserId"]); usrName = Convert.ToString(dr1["usrFirstName"]); cityId = Convert.ToInt32(dr1["usrCityId"]); ur.frnrelUserId = userId; ur.usrCityId = cityId; joiner = Convert.ToString(usrName); //ur.frnrelFrnRelName = usrName; //ur.frnrelRelation = "friend"; //ur.frnrelGroup = "1"; } string sqlFlagStr = "select JoinFlag from userMaster where usrMobileNo='" + flagMob.ToString() + "'"; int jof = Convert.ToInt32(cc.ExecuteScalar(sqlFlagStr)); if (jof >= 1) { JoinAll = true; ur.JoinFlagProp = Convert.ToString(jof); } string sqlquery = "select cityName from CityMaster where cityId='" + Convert.ToString(cityId) + "'"; cityName = cc.ExecuteScalar(sqlquery); urRegistBll.usrUserId = System.Guid.NewGuid().ToString(); ur.usrMobileNo = ur.usrAltMobileNo; ur.usrFirstName = ur.frnrelFrnRelName; Random rnd = new Random(); urRegistBll.usrPassword = cc.DESEncrypt(Convert.ToString(rnd.Next(10001, 99999))); status = urRegistBll.BLLInsertUserRegistrationInitial(urRegistBll); if (status > 0) { string sql1 = "select usrUserId, usrFirstName from UserMaster where usrMobileNo='" + ur.usrAltMobileNo + "'"; DataSet ds1 = new DataSet(); ds1 = cc.ExecuteDataset(sql1); //dt1 = ds.Tables[0]; string FriId; string FriName; foreach (DataRow dr2 in ds1.Tables[0].Rows) { FriId = Convert.ToString(dr2["usrUserId"]); FriName = Convert.ToString(dr2["usrFirstName"]); ur.frnrelFriendId = FriId; ur.frnrelFrnRelName = FriName; ur.frnrelRelation = "friend"; ur.frnrelGroup = Convert.ToString(grid); sender = Convert.ToString(FriName); } status = ur.BLLInsertUserFriendRelative(ur); if (status > 0) { } string senderId = userMobileWhoSendFriendReq.ToString(); string myMobileNo = urRegistBll.usrMobileNo; string myPassword = cc.DESDecrypt(urRegistBll.usrPassword); string myName = ur.frnrelFrnRelName; string thisDir = Server.MapPath("~"); if (!System.IO.Directory.Exists(thisDir + "\\User_Resource\\" + ur.usrUserId + "\\Profile_Photo\\")) { System.IO.Directory.CreateDirectory(thisDir + "\\User_Resource\\" + ur.usrUserId + "\\Profile_Photo\\"); File.Copy(thisDir + "\\User_Resource\\Profile_Photo\\default_user.jpg", thisDir + "\\User_Resource\\" + ur.usrUserId + "\\Profile_Photo\\default_user.jpg"); } //string passwordMessage = "Dear " + myName + ", Password for ur First Login is " + myPassword + " " + cc.AdvMessage(); string passwordMessage = "I " + usrName + "(" + senderId.ToString() + ") added u in come2mycity.com. U use it to send SMS.Dear " + myName + ",Password for ur First Login is " + myPassword + " for come2myCity.com"; cc.SendMessage1(senderId, myMobileNo, passwordMessage); cc.SendMessageImp1(senderId, myMobileNo, passwordMessage); if (JoinAll == true) { string resJoinAll = "Thanks " + joiner.ToString() + ", I " + sender.ToString() + "( " + myMobileNo.ToString() + " ) also added u on www.myct.in " + cc.AddSMS(senderId); cc.SendMessage1(myMobileNo, senderId, resJoinAll); } string changeFlagSql = "update come2mycity.test set FlagStatus = 0 where PK=" + Convert.ToInt32(ur.usrPKval); int pkchange = 0; pkchange = cc.ExecuteNonQuery(changeFlagSql); if (pkchange == 0) { pkchange = cc.ExecuteNonQuery(changeFlagSql); } } } } else { //NotRegisterMessageForLongCode(urRegistBll); } } catch (Exception ex) { throw ex; } }