Exemple #1
0
        public JsonResult GetOTP(string UID)
        {
            BALCommon obj     = new BALCommon(ConStr);
            bool      res     = false;
            string    message = "";

            try
            {
                string OTP = Utility.GetRendomString(6, "N");
                res = obj.SetOTP(UID, OTP);
                #region SendMail
                if (res)
                {
                    BALCommon   CSvc         = new BALCommon(ConStr);
                    UserMasters userMasters  = CSvc.getUserProfile(UID);
                    MailDetails _MailDetails = new MailDetails();
                    _MailDetails.ToMailIDs = userMasters.EMAILID;
                    _MailDetails.HTMLBody  = true;
                    _MailDetails.Subject   = "Reset OTP";
                    _MailDetails.Body      = BALMail.TemplateResetOTP(userMasters, AESEncrytDecry.EncryptStringAES(OTP));
                    if (BALMail.SendMail(_MailDetails))
                    {
                        message = "OTP has been sent to your registered mail id.";
                    }
                    else
                    {
                        message = "Please contact technical team";
                    }
                }
                else
                {
                    message = "Please contact technical team";
                }
                #endregion SendMail
            }
            catch (Exception ex)
            {
                res = false;
            }
            return(Json(message, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public ActionResult Create(SignupModel model, FormCollection collection)
        {
            BALCommon          CSvc   = new BALCommon(ConStr);
            OragnisationMaster master = new OragnisationMaster();

            //model.CountryList = CSvc.GetCountryList(0);
            //model.CityList = CSvc.GetCityList(0, 0);
            //model.StateList = CSvc.GetStateList(0, 0);
            if (ModelState.IsValid)
            {
                try
                {
                    master = CSvc.GetOragnisationAlready(model.LEmailId);
                    if (master.OMID == 0)
                    {
                        HttpPostedFileBase empimg     = Request.Files["emppathimage"];
                        string             folderpath = Constants.EMPATTACHMENT;

                        if (empimg.ContentLength > 0)
                        {
                            string guidstring = Guid.NewGuid().ToString();
                            string _FileName  = Path.GetFileName(empimg.FileName);
                            string filepath   = Path.Combine(Server.MapPath(folderpath) + guidstring + "_" + _FileName);
                            string dbpath     = Path.Combine(folderpath + guidstring + "_" + _FileName);
                            empimg.SaveAs(filepath);
                            master.OrgImage = dbpath;
                        }
                        else
                        {
                            string _FileName = "schooldummylogo.png";
                            string dbpath    = Path.Combine(folderpath + _FileName);
                            master.OrgImage = dbpath;
                        }
                        master.Oname        = model.Oname;
                        master.BOAddress    = model.BOAddress;
                        master.BOAddress2   = model.BOAddress2;
                        master.BOCity       = model.CITY_ID;
                        master.BOPincode    = model.BOPincode;
                        master.LCountry     = model.COUNTRY_ID;
                        master.LState       = model.STATE_ID;
                        master.LDistict     = model.LDistict;
                        master.LArea        = model.LArea;
                        master.LEmailId     = model.LEmailId;
                        master.LMobile      = model.LMobile;
                        master.LPhone       = model.LPhone;
                        master.LWebsite     = model.LWebsite;
                        master.OAfficilate  = model.OAfficilate;
                        master.OlicNo       = model.OlicNo;
                        master.OTaxNo       = model.OTaxNo;
                        master.OPanNo       = model.OPanNo;
                        master.OContactNo   = model.OContactNo;
                        master.IsActive     = false;
                        master.Createddate  = DateTime.Now;
                        master.Modifieddate = DateTime.Now;
                        master.CreatedBy    = "EndUser";
                        master.ModifiedBy   = "EndUser";
                        master.Otype        = "INS"; // to check
                        int _retua = CSvc.OragnasitionBasicopation(master);
                        if (_retua > 0)
                        {
                            string Password = Utility.GenerateRandomPassword();

                            WebSecurity.CreateUserAndAccount(master.LEmailId, Password, new { Name = master.OContactNo, Mobile = master.LMobile, EmailId = master.LEmailId, Address = master.BOAddress, RoleId = 1, CITY_ID = master.BOCity, STATE_ID = master.LState, COUNTRY_ID = master.LCountry, ISACTIVE = 0, SchoolID = _retua });
                            CSvc.Firstuserconfigure(_retua);//first user configure
                            //TempData[Constants.MessageInfo.SUCCESS] = Constants.Orgnisation_ADD_SUCCESS;
                            #region SendMail
                            MailDetails _MailDetails = new MailDetails();
                            _MailDetails.ToMailIDs = master.LEmailId;
                            _MailDetails.HTMLBody  = true;
                            _MailDetails.Subject   = "Organisation Registration";
                            _MailDetails.Body      = BALMail.TemplateOrganisation(master, AESEncrytDecry.EncryptStringAES(Password));
                            if (BALMail.SendMail(_MailDetails))
                            {
                                TempData[Constants.MessageInfo.SUCCESS] = Constants.Orgnisation_ADD_SUCCESS + ", Please check your mail inbox for more information.";
                            }
                            else
                            {
                                TempData[Constants.MessageInfo.SUCCESS] = Constants.Orgnisation_ADD_SUCCESS;
                            }
                            #endregion SendMail
                            return(RedirectToAction("login"));
                        }
                    }
                    else
                    {
                        TempData[Constants.MessageInfo.SUCCESS] = "Orgnisation is already Exist !";
                        return(RedirectToAction("Create"));
                    }
                }
                catch (Exception ex)
                {
                    WebSecurity.Logout();
                    ExecptionLogger.FileHandling("Account(Create_Post)", "Error_014", ex, "Account");
                }
            }

            return(View(model));
        }