Esempio n. 1
0
        public List <GetDRCSName> GetDRCSName()
        {
            List <GetDRCSName> lstGDN = new List <GetDRCSName>();
            SqlDataReader      rdr    = SqlHelper.ExecuteReader(Utility.GetConString(), CommandType.StoredProcedure, "[dbo].[GetDRCSName]");

            if (rdr.HasRows)
            {
                while (rdr.Read())
                {
                    GetDRCSName objGDN = new GetDRCSName
                    {
                        DRCSCode = Convert.ToInt32(rdr["DRCSCode"]),
                        DRCSName = rdr["DRCSName"].ToString()
                    };
                    lstGDN.Add(objGDN);
                }
            }
            return(lstGDN);
        }
Esempio n. 2
0
        public ActionResult CreateInspectorAccount(FormCollection collection)
        {
            InspectorListModel objILM = new InspectorListModel();
            ResgirationModels  objRM  = new ResgirationModels();
            EncryptionService  objES  = new EncryptionService();
            GetDRCSName        objGDN = new GetDRCSName();
            Account            objAcc = new Account();
            var salt = objES.CreateSalt();

            objRM.Username             = collection.Get("UserName");
            objRM.Password             = objES.EncryptPassword(collection.Get("Password"), salt);
            objRM.SecurityQuestionCode = collection.Get("SecurityQuestions");
            objRM.SecurityAnswer       = collection.Get("Anwser");
            objRM.Salt           = salt;
            objGDN.DRCSName      = collection.Get("DRCSName");
            objILM.InspectorName = collection.Get("InspectorOffice");
            objRM.FirstName      = collection.Get("Name");
            if (string.IsNullOrEmpty(objRM.FirstName))
            {
                ModelState.AddModelError("Name", "Please Enter the Name");
            }
            objRM.Mobile       = collection.Get("Mobile");
            objRM.EmailID      = collection.Get("Email");
            objRM.Gender       = collection.Get("Gender");
            objRM.DisCode      = collection.Get("District");
            objRM.ARCSCode     = collection.Get("ARCSOffice");
            objRM.UserTypeCode = 4;
            objRM.Role         = 3;
            objRM.CreatedBy    = "Admin";
            if (ModelState.IsValid)
            {
                int result = objAcc.SaveResgiratedUser(objRM);
                if (result == 1)
                {
                    return(RedirectToAction("Dashboard", "Admin"));
                }
            }
            else
            {
                return(View());
            }
            return(View());
        }