Пример #1
0
        public JsonResult Save_Nodal_Head_Details(mNodalHeadOfficers _obj)
        {
            string flag = "0";

            try
            {
                #region Encript Password
                Random rn = new Random();
#pragma warning disable SCS0005 // Weak random generator
                int month = rn.Next(1, 6);
#pragma warning restore SCS0005 // Weak random generator
                StringBuilder hashPassword = new StringBuilder();
                string        new_password = _obj.Password;
                switch (month)
                {
                case 1:
                    hashPassword.Append(Helper.ComputeHash(new_password, "MD5", null));
                    break;

                case 2:
                    hashPassword.Append(Helper.ComputeHash(new_password, "SHA1", null));
                    break;

                case 3:
                    hashPassword.Append(Helper.ComputeHash(new_password, "SHA256", null));
                    break;

                case 4:
                    hashPassword.Append(Helper.ComputeHash(new_password, "SHA384", null));
                    break;

                case 5:
                    hashPassword.Append(Helper.ComputeHash(new_password, "SHA512", null));
                    break;
                }
                _obj.Password = hashPassword.ToString();
                #endregion
                //_obj.Password = StringCipher.Encrypt(_obj.Password);
                InstituteRepository _objRepository = new InstituteRepository();
                string localIP = "?";
                localIP        = Request.ServerVariables["REMOTE_ADDR"].ToString();
                _obj.CreatedIP = localIP;
                DataSet _ds = _objRepository.Save_Preamble_Data(_obj);
                if (_ds != null)
                {
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        flag = _ds.Tables[0].Rows[0]["FLAG"].ToString();
                    }
                }
            }
            catch (System.Exception)
            {
                throw;
            }
            return(Json(new
            {
                flag = flag
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }