public bool CreateAccount(Account userdata, out bool IsDuplicate) { bool result = default(bool); IsDuplicate = false; try { result = new RepositoryCreator().AccountRepository.CreateAccount(userdata, out IsDuplicate); if (result == true && userdata.UserId > default(int)) { var connectionString = "AggieGlobal"; FarmManager fmanager = new FarmManager(connectionString); FarmDetail fDetail = new FarmDetail(); fDetail.FarmId = default(int); fDetail.FarmName = "Farm_" + userdata.EmailId; fDetail.FarmSize = default(int); fDetail.FarmSizeUnit = string.Empty; fDetail.FarmAddress = string.Empty; fDetail.FarmEstablishedDate = DateTime.Now; userdata.FarmId = fmanager.CreateUpdateFarm(fDetail); if (userdata.FarmId > default(int)) { fmanager.MapFarmByUserDetail(userdata.FarmId, userdata.UserId); } fmanager.Dispose(); } } catch (Exception ex) { AggieGlobalLogManager.Fatal("AccountManager :: CreateAccount failed :: " + ex.Message); } return(result); }
public void CreateSolution(PostAction postAction = PostAction.None) { Directory.CreateDirectory(Options.SolutionDir); Directory.CreateDirectory(Options.ApiProjectDir); Directory.CreateDirectory(Options.CoreProjectDir); Directory.CreateDirectory(Options.DataProjectDir); RepositoryCreator.CreateRepository(Options); var model = Solution.ScaffoldModel(Options); Solution.Save(model); switch (postAction) { case PostAction.OpenInExplorer: Process.Start("explorer.exe", Document.Options.SolutionDir); break; case PostAction.OpenInVisualStudio: if (!File.Exists(_devEnv)) { throw new Exception(string.Format("File '{0}' does not exist.", _devEnv)); } Process.Start(_devEnv, '"' + Document.Options.SolutionFile + '"'); break; } }
public int UpdateSession(string Email, int userId, string DeviceId) { int res = default(int); try { res = new RepositoryCreator().AccountRepository.UpdateSession(Email, userId, DeviceId); } catch (Exception ex) { AggieGlobalLogManager.Fatal("AccountManager :: CreateAccount failed :: " + ex.Message); } return(res); }
public AccountResponse GetAcountByUserClientData(string Email, int userId, string DeviceId) { AccountResponse user = null; try { user = new RepositoryCreator().AccountRepository.GetAcountByUserClientData(Email, userId, DeviceId); } catch (Exception ex) { AggieGlobalLogManager.Fatal("AccountManager :: CreateAccount failed :: " + ex.Message); } return(user); }
private void Add <T>(RepositoryCreator creator) { _repositoryCreators.Add(typeof(T), creator); }
private bool AuthorizeRequest(HttpActionContext actionContext) { bool validateData = false; if (HttpContext.Current.Request.ServerVariables["HTTP_REFERER"] != null) { string strRef = HttpContext.Current.Request.ServerVariables["HTTP_REFERER"]; if (!string.IsNullOrWhiteSpace(strRef)) { if (strRef.ToLower().Contains("google")) { throw new WebApiException(ErrorList.PermissionDenied, System.Net.HttpStatusCode.Unauthorized); } } } HttpRequestHeaders iheader = actionContext.Request.Headers; if (iheader.Contains("IsRegister") == true) { var IsRegister = iheader.GetValues("IsRegister").FirstOrDefault(); if (Convert.ToBoolean(IsRegister) == true) { validateData = true; } Account user = new Account(); user.AuthReason = AuthReason.Success; } else if (iheader.Contains("TokenKey") == true) { var tokenValue = iheader.GetValues("TokenKey").FirstOrDefault(); string decodetoken = EncryptionHelper.AesDecryption(tokenValue, EncryptionKey.LOG); string[] delimenator = new string[1]; delimenator[0] = "-"; string[] splitData = decodetoken.Split(delimenator, StringSplitOptions.None); Account user = null; if (splitData != null && splitData.Count() > default(int)) { SessionData idata = new SessionData(); idata._email = splitData[0]; idata._userId = Convert.ToInt32(splitData[1]); idata._deviceid = splitData[2]; HttpContext.Current.Session[ApplicationConstant.UserSession] = idata; user = new RepositoryCreator().AccountRepository.GetAcountUserDetailsById(idata._email, idata._userId, idata._deviceid); if (user.EmailId == idata._email && user.UserId == idata._userId && user.UserDeviceId == idata._deviceid) { validateData = true; } if (validateData == true) { user.AuthReason = AuthReason.Success; } else { user.AuthReason = AuthReason.NotSubscribed; } if (user.AuthReason != AuthReason.Success) { throw new WebApiException(ErrorList.AccountNotApproved, System.Net.HttpStatusCode.Unauthorized); } } } if (validateData == false) { throw new WebApiException(ErrorList.AccountNotApproved, System.Net.HttpStatusCode.Unauthorized); } return(validateData); }
public CreateRepositoryTask(RepositoryCreator repositoryCreator) { _repositoryCreator = repositoryCreator; }