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 int CreateUpdateFarmAndPlot(FarmDetail requestData) { try { return(new RepositoryCreator().FarmRepository.CreateUpdateFarm(requestData)); } catch (Exception ex) { AggieGlobalLogManager.Fatal("FarmManager :: CreateUpdateFarmAndPlot failed :: " + ex.Message); } return(requestData.FarmId); }