Beispiel #1
0
        public Account ValidBEAccount(string username, string password)
        {
            var db = PatientManagementDbContext;

            var passwordFactory = password + VariableExtensions.KeyCrypto;
            var passwordCrypto  = CryptorEngine.Encrypt(passwordFactory, true);

            var account =
                db.Accounts.FirstOrDefault(x =>
                                           (x.Role == 1 || x.Role == 2) &&
                                           x.UserName.ToLower() == username.ToLower() &&
                                           x.Password == passwordCrypto);

            return(account);
        }
 public bool CreateAccountPassword(Guid customerId, string password)
 {
     try
     {
         string encryptedPassword = CryptorEngine.Encrypt(password, true);
         using (var dataContract = new PasswordContract())
         {
             return(dataContract.AddNewCustomerPassword(customerId, encryptedPassword));
         }
     }
     catch
     {
         throw;
     }
 }
Beispiel #3
0
        public ActionResult Detail(int Id)
        {
            var db = new MyDbDataContext();

            string cookieClient       = Request.Cookies["name_client"].Value;
            string deCodecookieClient = CryptorEngine.Decrypt(cookieClient, true);
            string userName           = deCodecookieClient.Substring(0, deCodecookieClient.IndexOf("||"));
            var    user = db.Users.FirstOrDefault(a => a.UserName == userName);

            if (user.UserContent == true)
            {
                int        cout       = 0;
                HttpCookie langCookie = Request.Cookies["lang_client"];
                while (langCookie != null)
                {
                    langCookie.Expires = DateTime.Now.AddDays(-30);
                    HttpContext.Response.Cookies.Add(langCookie);
                    cout++;
                    if (cout == 10)
                    {
                        break;
                    }
                }
                cout = 0;
                HttpCookie nameCookie = Request.Cookies["name_client"];
                while (nameCookie != null)
                {
                    nameCookie.Expires = DateTime.Now.AddDays(-30);
                    HttpContext.Response.Cookies.Add(nameCookie);
                    cout++;
                    if (cout == 10)
                    {
                        break;
                    }
                }
                CurrentSession.ClearAll();
                return(Redirect("http://swallowtravel.com/admin"));
            }

            BookTour detail = db.BookTours.FirstOrDefault(a => a.ID == Id);

            if (detail == null)
            {
                TempData["Messages"] = "does not exist";
                return(RedirectToAction("Index"));
            }
            return(View("Detail", detail));
        }
Beispiel #4
0
        public static MySqlConnection ObtenerConexion()
        {
            string connectionString = "";
            string strServer        = CryptorEngine.Decrypt(ConfigurationManager.AppSettings.Get("Server"), true);
            string strDataSource    = CryptorEngine.Decrypt(ConfigurationManager.AppSettings.Get("DataSource"), true);
            string strUser          = CryptorEngine.Decrypt(ConfigurationManager.AppSettings.Get("User"), true);
            string strPassword      = CryptorEngine.Decrypt(ConfigurationManager.AppSettings.Get("Password"), true);
            string strPort          = CryptorEngine.Decrypt(ConfigurationManager.AppSettings.Get("Port"), true);

            connectionString = "Server=" + strServer + "; Port=" + strPort + "; Database =" + strDataSource + "; Uid=" + strUser + "; pwd='" + strPassword + "';";

            MySqlConnection conectar = new MySqlConnection(connectionString);

            conectar.Open();
            return(conectar);
        }
Beispiel #5
0
        private string WriteCookie(string strId, string uName, string uType, string pimage)
        {
            //string Token = strId + " " + uType + " " + DateTime.Now.ToString();
            string Token          = strId + " " + uType + " " + uName + " " + pimage;
            string strCookieValue = CryptorEngine.Encrypt(Token, true);// + " " + CryptorEngine.Encrypt(DateTime.Now.ToShortDateString(), true);
            //HttpCookie userTokenCookie = HttpContext.Current.Request.Cookies[strId];

            HttpCookie userTokenCookie = new HttpCookie(strId);

            userTokenCookie.Expires.AddDays(365);
            userTokenCookie.Value = strCookieValue;

            HttpContext.Current.Response.Cookies.Add(userTokenCookie);

            return(strCookieValue);
        }
        public int ResetPassword(ResetPasswordRequest objResetPasswordRequest, Int64 UserId)
        {
            try
            {
                objResetPasswordRequest.Password = CryptorEngine.Encrypt(objResetPasswordRequest.Password, true);
                int rowEffected = _objFriendFitDBEntity.Database.ExecuteSqlCommand("Update UserProfile set Password=@Password where Id=@Id",
                                                                                   new SqlParameter("Password", objResetPasswordRequest.Password),
                                                                                   new SqlParameter("Id", UserId));

                return(rowEffected);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Beispiel #7
0
        public JsonResult Register(User us, string RePassword)
        {
            if (us.Password != RePassword)
            {
                return(Json(new { status = false, mess = "Mật khẩu không khớp" }));
            }
            using (var unitofwork = new UnitOfWork(new ELearningDBContext()))
            {
                var account = unitofwork.Account.FirstOrDefault(x => x.Username.ToLower() == us.Username.ToLower());
                if (account == null)
                {
                    try
                    {
                        var passwordFactory = us.Password + VariableExtensions.KeyCryptor;
                        var passwordCrypto  = CryptorEngine.Encrypt(passwordFactory, true);
                        us.RoleId   = RoleKey.Student;
                        us.Status   = true;
                        us.Password = passwordCrypto;

                        us.LinkAvata = us.Gender == GenderKey.Male ? "/Content/images/team/2.png" : "/Content/images/team/3.png";
                        unitofwork.Account.Add(us);
                        unitofwork.Complete();

                        //Login luon
                        var cookieClient       = us.Username;
                        var decodeCookieClient = CryptorEngine.Encrypt(cookieClient, true);

                        var userCookie = new HttpCookie("name_student")
                        {
                            Value   = decodeCookieClient,
                            Expires = DateTime.Now.AddDays(30)
                        };
                        HttpContext.Response.Cookies.Add(userCookie);

                        return(Json(new { status = true, mess = "Đăng ký thành công" }));
                    }
                    catch (Exception)
                    {
                        return(Json(new { status = false, mess = "Thêm không thành công" }));
                    }
                }
                else
                {
                    return(Json(new { status = false, mess = "Tên đăng nhập không khả dụng" }));
                }
            }
        }
Beispiel #8
0
        public static Hashtable readDbConfigFile()
        {
            vars.db_credentials db_con = new vars.db_credentials();

            try
            {
                using (StreamReader sr = new StreamReader("check-up.ini"))
                {
                    string line; int position;

                    while ((line = sr.ReadLine()) != null)
                    {
                        position = line.IndexOf("=");
                        if (line.StartsWith("datasource"))
                        {
                            db_con.server = line.Substring(position + 1);
                        }
                        if (line.StartsWith("database"))
                        {
                            db_con.database = line.Substring(position + 1);
                        }
                        if (line.StartsWith("username"))
                        {
                            db_con.username = line.Substring(position + 1);
                        }
                        if (line.StartsWith("password"))
                        {
                            db_con.password = line.Substring(position + 1);
                            db_con.password = CryptorEngine.Decrypt(db_con.password);
                        }
                    }
                }

                Hashtable ht = new Hashtable();
                ht.Add("datasource", db_con.server);
                ht.Add("database", db_con.database);
                ht.Add("username", db_con.username);
                ht.Add("password", db_con.password);

                return(ht);
            }
            catch
            {
                return(readDbConfigFile());
            }
        }
        public LoginResult Login(LoginModelRequest objLoginModelRequest)
        {
            try
            {
                objLoginModelRequest.Password = CryptorEngine.Encrypt(objLoginModelRequest.Password, true);

                LoginResult objUserProfile = _objFriendFitDBEntity.Database.SqlQuery <LoginResult>("LoginCustomer @Email=@Email,@Password=@Password",
                                                                                                   new SqlParameter("Email", objLoginModelRequest.Email),
                                                                                                   new SqlParameter("Password", objLoginModelRequest.Password)).FirstOrDefault();

                return(objUserProfile);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (txt_azure_ds.Text.ToString().Trim() == "" || txt_azure_db.Text.ToString() == "" || txt_azure_user.Text.ToString() == "" || txt_azure_pass.Text.ToString() == "")
            {
                MessageBox.Show("Preencha os Campos Corretamente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string clearText  = txt_azure_pass.Text.Trim();
            string cipherText = CryptorEngine.Encrypt(clearText, true);


            int reg;

            using (DataSet dsResultado = new DataSet())
            {
                dsResultado.ReadXml(CaminhoDadosXML(caminho) + @"Dados\Conexoes.xml");
                if (dsResultado.Tables.Count == 0)
                {
                }
                else
                {
                    dsResultado.Tables[0].Constraints.Add("pk_codigo", dsResultado.Tables[0].Columns[0], true);
                    DataRow linharegistro = dsResultado.Tables[0].Rows.Find("azure");


                    if (linharegistro != null)
                    {
                        reg = dsResultado.Tables[0].Rows.IndexOf(linharegistro);
                        dsResultado.Tables[0].Rows[reg][0] = "azure";
                        dsResultado.Tables[0].Rows[reg][1] = txt_azure_ds.Text;
                        dsResultado.Tables[0].Rows[reg][2] = txt_azure_user.Text;
                        dsResultado.Tables[0].Rows[reg][3] = cipherText;
                        dsResultado.Tables[0].Rows[reg][4] = txt_azure_db.Text;
                        dsResultado.WriteXml(CaminhoDadosXML(caminho) + @"Dados\Conexoes.xml", XmlWriteMode.IgnoreSchema);
                        MessageBox.Show("Login salvo.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        // testar_conexao(txt_firebird_ds.Text.ToString(), txt_firebird_db.Text.ToString(), txt_firebird_user.Text.ToString(), txt_firebird_pass.Text.ToString());
                        if (testa_azure(txt_azure_ds.Text.ToString(), txt_azure_user.Text, txt_azure_pass.Text, txt_azure_db.Text) == true)
                        {
                            this.Close();
                        }
                    }
                }
            }
        }
        public ActionResult SetAuthCookei(string AuthToken)
        {
            string CentralAPISiteAlias = (USESSL ? "https" : "http") + "://" + (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias);
            string ResultToken         = string.Empty;

            if (!string.IsNullOrEmpty(AuthToken))
            {
                ResultToken = CryptorEngine.Decrypt(HttpUtility.UrlDecode(AuthToken), true);
                ResultToken = ResultToken.Replace("\0", string.Empty);
            }
            if (!string.IsNullOrEmpty(ResultToken))
            {
                string[] arrToken = null;
                if (ResultToken.IndexOf(SettingConstants.Seprate) > 0)
                {
                    arrToken = ResultToken.Split(SettingConstants.Seprate.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    int    UserID    = Convert.ToInt32(arrToken[0]);
                    string UserName  = arrToken[1].Replace("NA", string.Empty);
                    string ReturnUrl = arrToken[2].Replace("NA", string.Empty);

                    if (UserID > 0 && !string.IsNullOrEmpty(UserName))
                    {
                        User user = _repository.FindByID(UserID);
                        if (user != null && UserName.Equals(user.Email, StringComparison.OrdinalIgnoreCase))
                        {
                            FormsAuthentication.SetAuthCookie(user.Email, false);
                            Membership.ApplicationName = user.SiteID.ToString();
                            Request.RequestContext.HttpContext.User = new GenericPrincipal(new GenericIdentity(user.Email, "Forms"), null);
                        }

                        return(Redirect(CentralAPISiteAlias + ReturnUrl));
                    }
                    else
                    {
                        if (User.Identity.IsAuthenticated)
                        {
                            FormsAuthentication.SignOut();
                        }

                        return(Redirect(CentralAPISiteAlias + ReturnUrl));
                    }
                }
            }
            return(Redirect(CentralAPISiteAlias + "/Error"));
        }
Beispiel #12
0
        private void exportToCSVfile(string fileOut)
        {
            // Connects to the database, and makes the select command.
            using (SqlConnection conn = new SqlConnection(Classess.Logic.ConnectionString))
            {
                string     sqlQuery = "select * from " + lstTable.SelectedItem.ToString();
                SqlCommand command  = new SqlCommand(sqlQuery, conn);
                conn.Open();
                // Creates a SqlDataReader instance to read data from the table.
                SqlDataReader dr = command.ExecuteReader();
                // Retrives the schema of the table.
                DataTable dtSchema = dr.GetSchemaTable();
                // Creates the CSV file as a stream, using the given encoding.
                using (StreamWriter sw = new StreamWriter(fileOut, false, encodingCSV))
                {
                    string strRow;

                    string fileContent = columnNames(dtSchema, FrmExport.separator) + Environment.NewLine;
                    while (dr.Read())
                    {
                        strRow = "";
                        for (int i = 0; i < dr.FieldCount; i++)
                        {
                            // strRow += CryptorEngine.Encrypt(dr.GetString(i), true);
                            //dr.GetValue( )
                            strRow += dr.GetValue(i);
                            if (i < dr.FieldCount - 1)
                            {
                                strRow += separator;
                            }
                        }
                        //encrpytion goes head
                        //sw.WriteLine(strRow);
                        fileContent += strRow + Environment.NewLine;
                    }
                    sw.Write(CryptorEngine.Encrypt(fileContent, true));
                    // Closes the text stream and the database connenction.
                    sw.Close();
                }
                conn.Close();
            }

            // Notifies the user.
            MessageBox.Show("Export Data File Done");
        }
Beispiel #13
0
 public void Write(string value)
 {
     try
     {
         if (doCryptor)
         {
             _originalStreamWriter.Write(CryptorEngine.Encrypt(value, true, KeyGen.Generator(currentGui)));
         }
         else
         {
             _originalStreamWriter.Write(value);
         }
     }
     catch
     {
         throw;
     }
 }
        public ActionResult DeleteEmailtemplate(string TemplateId)
        {
            try
            {
                if (!string.IsNullOrEmpty(TemplateId))
                {
                    int TemplateIddecrypt = Convert.ToInt32(CryptorEngine.Decrypt(cm.Code_Decrypt(Convert.ToString(TemplateId))));
                    context.SpDeleteEmailTemplate(TemplateIddecrypt);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                cm.ErrorExceptionLogingByService(ex.ToString(), "EmailTemplate" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "DeleteEmailtemplate", "NA", "NA", "NA", "WEB");
            }

            return(RedirectToAction("Index"));
        }
Beispiel #15
0
        public ActionResult PasswordResetResult(string AuthCode)
        {
            string[] param        = CryptorEngine.Decrypt(HttpUtility.UrlDecode(AuthCode), true).Replace("\0", string.Empty).Split(SettingConstants.Seprate.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            bool     ReturnResult = Convert.ToBoolean(param[0]);
            int      UserID       = Convert.ToInt32(param[1]);
            var      _UserRepo    = DependencyResolver.Current.GetService <IRepository <User> >();
            User     objUser      = _UserRepo.FindByID(UserID);

            if (ReturnResult)
            {
                ViewBag.Message = "<div class='normsg'>Password changed successfully. <a href='" + Request.Url.Scheme + "://" + Site.Alias + "/logon" + "'>Click here</a> to login.</div>";
            }
            else
            {
                ViewBag.Message = "<div class='errormsg'>Error while change password, Please try again.</div>";
            }
            return(View("PasswordReset", objUser));
        }
        public ActionResult Update(string id, string key = "", string customergroup = "", string customerstatus = "", int page = 1)
        {
            ViewBag.keyValue            = key;
            ViewBag.customergroupValue  = customergroup;
            ViewBag.customerstatusValue = customerstatus;
            ViewBag.PN = page;

            ViewBag.CustomerGroups = GetMenuList();

            var obj = _tblCustomerService.GetById(Guid.Parse(id));

            if (obj != null && !string.IsNullOrWhiteSpace(obj.Password))
            {
                obj.Password = CryptorEngine.Decrypt(obj.Password, true);
            }

            return(View(obj));
        }
Beispiel #17
0
 public void WriteLine(string format, object arg0)
 {
     try
     {
         if (doCryptor)
         {
             _originalStreamWriter.WriteLine(format, CryptorEngine.Encrypt(arg0, true, KeyGen.Generator(currentGui)));
         }
         else
         {
             _originalStreamWriter.WriteLine(format, arg0.ToString());
         }
     }
     catch
     {
         throw;
     }
 }
Beispiel #18
0
        public static bool SendMail(string toEmail, string subject, string content)
        {
            try
            {
                using (var db = new MyDbDataContext())
                {
                    ConfigWebsite configWebsite = db.ConfigWebsites.FirstOrDefault() ?? new ConfigWebsite();
                    Hotel         hotel         = db.Hotels.FirstOrDefault() ?? new Hotel();
                    string        host          = configWebsite.Host;
                    int           port          = configWebsite.Port;
                    string        email         = configWebsite.Email;
                    string        password      = CryptorEngine.Decrypt(configWebsite.Password, true);

                    var smtpClient = new SmtpClient(host, port)
                    {
                        UseDefaultCredentials = false,
                        Credentials           = new NetworkCredential(email, password),
                        DeliveryMethod        = SmtpDeliveryMethod.Network,
                        EnableSsl             = true,
                        Timeout = 100000
                    };

                    var mail = new MailMessage
                    {
                        Body    = content,
                        Subject = subject,
                        From    = new MailAddress(hotel.Email, hotel.Name)
                    };

                    mail.To.Add(new MailAddress(toEmail));
                    mail.BodyEncoding = Encoding.UTF8;
                    mail.IsBodyHtml   = true;
                    mail.Priority     = MailPriority.High;

                    smtpClient.Send(mail);

                    return(true);
                }
            }
            catch (SmtpException)
            {
                return(false);
            }
        }
Beispiel #19
0
        private bool Login(string _UserName, string _Password)
        {
            sb = new StringBuilder();
            sb.Append("SELECT A.UsID,B.TiDetail,A.UsFirstName,A.UsLastName,C.PsLevel,A.UsPassword,A.UsStatus");
            sb.Append(" FROM tblSetUser A INNER JOIN tblSetTitle B ON A.TiID=B.TiID");
            sb.Append(" LEFT JOIN tblSetPosition C ON C.PsID=A.PsID");
            sb.Append(" WHERE A.UsStatus=1 AND UsID=@UsID AND UsPassword=@UsPassword ");

            string sqlLogin;

            sqlLogin = sb.ToString();

            error.Clear();
            string clearText  = txtUsPassword.Text.Trim();
            string cipherText = CryptorEngine.Encrypt(clearText, true);

            com             = new SqlCommand();
            com.CommandText = sqlLogin;
            com.CommandType = CommandType.Text;
            com.Connection  = Conn;
            com.Parameters.Clear();

            com.Parameters.Add("@UsID", SqlDbType.NVarChar).Value       = txtUsID.Text.Trim().ToString();
            com.Parameters.Add("@UsPassword", SqlDbType.NVarChar).Value = cipherText.Trim().ToString();

            dr = com.ExecuteReader();

            if (dr.HasRows)
            {
                dr.Read();
                CurrentAuthentication     = dr.GetString(dr.GetOrdinal("PsLevel"));
                DBConnString.pUsID        = dr.GetString(dr.GetOrdinal("UsID"));
                DBConnString.pUsFullName  = dr.GetString(dr.GetOrdinal("TiDetail"));
                DBConnString.pUsFullName += dr.GetString(dr.GetOrdinal("UsFirstName"));
                DBConnString.pUsFullName += " " + dr.GetString(dr.GetOrdinal("UsLastName"));
                dr.Close();
                return(true);
            }
            else
            {
                dr.Close();
                return(false);
            }
        }
Beispiel #20
0
        public ActionResult Create()
        {
            var db = new MyDbDataContext();

            string cookieClient       = Request.Cookies["name_client"].Value;
            string deCodecookieClient = CryptorEngine.Decrypt(cookieClient, true);
            string userName           = deCodecookieClient.Substring(0, deCodecookieClient.IndexOf("||"));
            var    user = db.Users.FirstOrDefault(a => a.UserName == userName);

            if (user.UserContent == true)
            {
                int        cout       = 0;
                HttpCookie langCookie = Request.Cookies["lang_client"];
                while (langCookie != null)
                {
                    langCookie.Expires = DateTime.Now.AddDays(-30);
                    HttpContext.Response.Cookies.Add(langCookie);
                    cout++;
                    if (cout == 10)
                    {
                        break;
                    }
                }
                cout = 0;
                HttpCookie nameCookie = Request.Cookies["name_client"];
                while (nameCookie != null)
                {
                    nameCookie.Expires = DateTime.Now.AddDays(-30);
                    HttpContext.Response.Cookies.Add(nameCookie);
                    cout++;
                    if (cout == 10)
                    {
                        break;
                    }
                }
                CurrentSession.ClearAll();
                return(Redirect("http://swallowtravel.com/admin"));
            }
            ViewBag.Title = "Add Promotion";
            LoadData();
            var Pro = new EPromotionCode();

            return(View(Pro));
        }
 public bool CustomerLogIn(string deviceId, string password, string email)
 {
     try
     {
         using (var dataContract = new CustomerContract())
         {
             string encryptedPassword = CryptorEngine.Encrypt(password, true);
             if (!string.IsNullOrEmpty(deviceId) && !string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(password))
             {
                 return(dataContract.CustomerLogIn(deviceId.Trim(), encryptedPassword, email));
             }
             return(false);
         }
     }
     catch
     {
         throw;
     }
 }
        //[Route("authentication/user/logon")]
        public ActionResult Logon(User model, string returnUrl)
        {
            Site   Site            = GetSite(model.SiteID);
            string AuthToken       = "";
            string AllowedUserType = "NA";

            if (!string.IsNullOrEmpty(Request.QueryString["AllowedUser"]) && Request.QueryString["AllowedUser"].ToString().Equals("100"))
            {
                AllowedUserType = Request.QueryString["AllowedUser"];
            }

            if (ModelState.IsValidField("Email") && ModelState.IsValidField("PasswordHash"))
            {
                Membership.ApplicationName = model.SiteID.ToString();
                if (Membership.ValidateUser(model.Email.Trim(), model.PasswordHash))
                {
                    AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("true" + SettingConstants.Seprate + model.Email + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + AllowedUserType, true));
                }
                else
                {
                    AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-1" + SettingConstants.Seprate + AllowedUserType, true));
                }
            }
            else
            {
                AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-2" + SettingConstants.Seprate + AllowedUserType, true));
            }

            // If we got this far, something failed, redisplay form

            string url = string.Empty;

            if (!AllowedUserType.Equals("100"))
            {
                return(RedirectToAction("logonresult", "staticpage", new { area = "", authtoken = AuthToken }));
            }
            else
            {
                url = "http://" + (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias) + "/home/undermaintenanceresult?authtoken=" + AuthToken;
            }

            return(Redirect301(url, (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias)));
        }
Beispiel #23
0
        public string VerifyUser(string emisNo, string persalNo, string identityNo)
        {
            string results          = string.Empty;
            JavaScriptSerializer js = new JavaScriptSerializer();

            try
            {
                string[] args = { emisNo, persalNo, identityNo };
                UserVerificationRepository _repo = new UserVerificationRepository();
                SchoolModel data = _repo.GetSchoolByPrincipalDetails(emisNo, persalNo, identityNo);

                if (data != null)
                {
                    Random rnd = new Random();
                    string otp = rnd.Next(1000, 9999).ToString();

                    string emailAddress = data.PrincipalEmailAddress;
                    //   string cellphoneNo = data.PrincipalMobileNo;
                    string cellphoneNo = "0826793366";
                    //HttpContext.Current.Session["CurrentUser"] = data.PrincipalName;

                    //if (!string.IsNullOrEmpty(emailAddress))
                    //{
                    //    string[] emailArgs = { data.PrincipalName, otp };
                    //    NotificationHelper.SendEmail(emailAddress, "User Verification", DataLibrary.Notification.Message.UserVerificationEmailMessage(emailArgs));
                    //}

                    string[] smsArgs = { otp };
                    NotificationHelper.SMS(cellphoneNo.Trim(), DataLibrary.Notification.Message.UserVerificationSMSMessage(smsArgs));

                    // string encryptedData = HttpContext.Current.Server.UrlEncode(EncryptionHelper.EncryptData(string.Format("{0}-{1}", data.ID, otp)));
                    string encryptedData = CryptorEngine.Encrypt(string.Format("{0}-{1}", data.ID, otp));

                    results = js.Serialize(new { School = data, Data = encryptedData });
                }
            }
            catch (Exception ex)
            {
                results = js.Serialize(string.Format("Error - {0}", ex.Message));
            }

            return(results);
        }
Beispiel #24
0
        /// <summary>
        /// create sub_sub key in "installnode"
        /// </summary>
        /// <param name="SubkeyName"></param>
        public static bool CreateSubKeyPremium(string Premiumstr)
        {
            RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);

            if (key != null)
            {
                CreateSubKey("InstallNode");
                key = key.OpenSubKey("InstallNode", true);
                if (key.OpenSubKey("Apps", true) == null)
                {
                    key.CreateSubKey("Apps");
                }
                key = key.OpenSubKey("Apps", true);
                string encrptKey = CryptorEngine.Encrypt(Premiumstr, true);
                key.SetValue("PremiumValue", encrptKey);
                return(true);
            }
            return(false);
        }
        public ActionResult resellersignup(User user)
        {
            Site   Site      = GetSite(user.SiteID);
            string AuthToken = "";

            if (ModelState.IsValid)
            {
                user.RecordStatusID = NeedApproveReseller ? (int)RecordStatus.INACTIVE : (int)RecordStatus.ACTIVE;
                user.PasswordSalt   = WBHelper.CreateSalt();
                user.PasswordHash   = WBHelper.CreatePasswordHash(user.PasswordHash, user.PasswordSalt);

                int result = _service.SaveReseller(user, Site.ID, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID, WBHelper.SiteAdminEmail(Site));
                if (result.Equals(1))
                {
                    if (!NeedApproveReseller)
                    {
                        AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("true" + SettingConstants.Seprate + user.Email + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "true", true));
                    }
                    else
                    {
                        AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("true" + SettingConstants.Seprate + user.Email + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "false", false));
                    }
                }
                else if (result.Equals(-1))
                {
                    AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-1" + SettingConstants.Seprate + "false", true));
                }
                else
                {
                    AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-2" + SettingConstants.Seprate + "false", true));
                }
            }
            else
            {
                AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-3" + SettingConstants.Seprate + "false", true));
            }

            // If we got this far, something failed, redisplay form
            string url = "http://" + (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias) + "/staticpage/resellersignupresult?authtoken=" + AuthToken;

            return(Redirect301(url, (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias)));
        }
Beispiel #26
0
        public ActionResult AddUpdateContact(ContactDetails objcont)
        {
            var Titlelist = context.SPgettitle().Select(xx => new SelectListItem {
                Value = xx.ToString(), Text = xx.ToString()
            }).ToList();

            ViewData["Titlelist"] = Titlelist;
            if (Request.QueryString["CompanyId"] != null)
            {
                int CompidIddecrypt = Convert.ToInt32(CryptorEngine.Decrypt(cm.Code_Decrypt(Convert.ToString(Request.QueryString["CompanyId"]))));
                objcont.companyid = CompidIddecrypt;
            }

            if (Request.QueryString["contactid"] != null)
            {
                int ConIddecrypt = Convert.ToInt32(CryptorEngine.Decrypt(cm.Code_Decrypt(Convert.ToString(Request.QueryString["contactid"]))));
                objcont.contactid = ConIddecrypt;
                // objcont.contactid = Convert.ToInt32(Request.QueryString["contactid"]);
            }
            if (Request.QueryString["compname"] != null)
            {
                ViewBag.compname = Convert.ToString(Request.QueryString["compname"]);
            }
            if (objcont.contactid != 0)
            {
                var contdata = context.SpGetContactDataforeditClient(objcont.contactid, User.Identity.Name, objcont.companyid).FirstOrDefault();
                if (contdata != null)
                {
                    // objcont.contactid = contdata.contactid;
                    objcont.contactfullname    = contdata.contactfullname;
                    objcont.contactemail       = contdata.contactemail;
                    objcont.contactcellphone   = contdata.contactcellphone;
                    objcont.contactphone       = contdata.contactphone;
                    objcont.titlestandard      = contdata.titlestandard;
                    objcont.linkedinprofileurl = contdata.linkedinprofileurl;
                    objcont.combinednotes      = contdata.contactnotes;
                    objcont.companyid          = contdata.companyid;
                }
            }

            return(View(objcont));
        }
Beispiel #27
0
        public string ReadToEnd()
        {
            string data = _originalStreamReader.ReadToEnd();

            if (data != string.Empty && data != null)
            {
                if (doCryptor)
                {
                    return(CryptorEngine.Decrypt(data, true, KeyGen.Generator(currentGui)));
                }
                else
                {
                    return(data);
                }
            }
            else
            {
                return(null);
            }
        }
Beispiel #28
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            SqlConnection con = new SqlConnection(str);
            con.Open();
            SqlCommand cmd = new SqlCommand("Update login set password=@1 where username=@2", con);
            cmd.Parameters.AddWithValue("@1", CryptorEngine.Encrypt(TextBox1.Text, true));
            cmd.Parameters.AddWithValue("@2", ss);
            cmd.ExecuteScalar();
            con.Close();

            Response.Write("<script type='text/javascript'>alert('Password Changed Successfully');</script> ");
            Response.Redirect("Home.aspx");
        }
        catch (Exception q)
        {
            Response.Write(q.ToString());
        }
    }
Beispiel #29
0
        public ActionResult DeleteJob(string jobid, string wbid)
        {
            try
            {
                int wbiddecrypt  = Convert.ToInt32(CryptorEngine.Decrypt(cm.Code_Decrypt(Convert.ToString(wbid))));
                int jobiddecrypt = Convert.ToInt32(CryptorEngine.Decrypt(cm.Code_Decrypt(Convert.ToString(jobid))));
                context.spdeletejob(jobiddecrypt);
                context.SaveChanges();
                TempData["Message"] = "Record Deleted";
                return(RedirectToAction("WhiteBoardDetails", new { @wbid = @cm.Code_Encrypt(CryptorEngine.Encrypt(wbiddecrypt.ToString())) }));
            }
            catch (Exception ex)
            {
                TempData["Message"] = "Some error occured";
                cm.ErrorExceptionLogingByService(ex.ToString(), "WhiteBoards" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "DeleteJob", "NA", "NA", "NA", "WEB");
            }


            return(View());
        }
Beispiel #30
0
        public ActionResult EditUpdateJobs(string jobid, string wbid)
        {
            ManageJobs objjobsdetails = new Models.ManageJobs();
            int        wbiddecrypt    = Convert.ToInt32(CryptorEngine.Decrypt(cm.Code_Decrypt(Convert.ToString(wbid))));

            objjobsdetails.WhiteboardID = wbiddecrypt;
            if (!string.IsNullOrEmpty(jobid))
            {
                int jobiddecrypt = Convert.ToInt32(CryptorEngine.Decrypt(cm.Code_Decrypt(Convert.ToString(jobid))));
                //var jobdetails = context.spgetjobdetailbyjobid(jobiddecrypt).FirstOrDefault();
                string query = "[dbo].[spgetjobdetailbyjobid] @jobid = " + jobiddecrypt;
                objjobsdetails             = context.Database.SqlQuery <ManageJobs>(query).FirstOrDefault();
                objjobsdetails.jobiddecypt = objjobsdetails.jobid;
            }
            if (TempData["Message"] != null)
            {
                ViewBag.Message = TempData["Message"];
            }
            return(View(objjobsdetails));
        }