public int AddReligion(Religion religion) { _context.Religions.Add(religion); _context.SaveChanges(); return(religion.Id); }
private List <Law> FilterLaws(Culture cul, Religion rel, IEnumerable <Law> lawList) { List <Law> posLaws = new List <Law>(); foreach (Law sc in lawList) { if (sc.BannedCultures.Contains(cul.Name) || sc.BannedCultures.Contains(cul.Group.Name)) { continue; } if (sc.BannedReligions.Contains(rel.Name) || sc.BannedReligions.Contains(rel.Group.Name)) { continue; } if (sc.AllowedCultures.Count > 0) { if (!sc.AllowedCultures.Contains(cul.Name) && !sc.AllowedCultures.Contains(cul.Group.Name)) { continue; } } if (sc.AllowedReligions.Count > 0) { if (!sc.AllowedReligions.Contains(rel.Name) && !sc.AllowedReligions.Contains(rel.Group.Name)) { continue; } } posLaws.Add(sc); } return(posLaws); }
public new HashSet <string> GetSelectedFieldsList() { var hs = base.GetSelectedFieldsList(); if (Smokes.Count > 0 && Smokes.Any(p => p > 0)) { hs.Add("Smokes"); } if (Alcohol.Count > 0 && Alcohol.Any(p => p > 0)) { hs.Add("Alcohol"); } if (Religion.Count > 0 && Religion.Any(p => p > 0)) { hs.Add("Religion"); } if (DickSize.Count > 0 && DickSize.Any(p => p > 0)) { hs.Add("DickSize"); } if (DickThickness.Count > 0 && DickThickness.Any(p => p > 0)) { hs.Add("DickThickness"); } if (BreastSize.Count > 0 && BreastSize.Any(p => p > 0)) { hs.Add("BreastSize"); } return(hs); }
internal Religion GenerateReligion() { if (religionList.names.Count <= 0) { return(null); } Religion religion = new Religion(); int randomName = UnityEngine.Random.Range(0, religionList.names.Count); religion.religionName = religionList.names[randomName]; religion.gods = GetGods(); religion.focus = GetFocus(); religion.expectation = GetExpectation(); religion.forbidden = GetForbidden(); if (religion.gods.Length == 2) { religion.sentence = "This religion worship " + religion.gods [0] + " and " + religion.gods [1] + ". They are focused on " + religion.focus [0] + " and " + religion.focus [1] + ". People are expected to be " + religion.expectation [0] + " and " + religion.expectation [1] + ". They are not allowed " + religion.forbidden [0] + " and " + religion.forbidden [1] + "."; } else { religion.sentence = "This religion worships " + religion.gods [0] + ". They are focused on " + religion.focus [0] + " and " + religion.focus [1] + ". People are expected to be " + religion.expectation [0] + " and " + religion.expectation [1] + ". They are not allowed " + religion.forbidden [0] + " and " + religion.forbidden [1] + "."; } religionList.names.RemoveAt(randomName); allReligions.Add(religion); return(religion); }
public async Task <ResponseModel> Insert(ReligionModel model) { ResponseModel response = new ResponseModel(); try { Religion md = new Religion(); md.Name = model.Name; md.Precedence = model.Precedence; md.IsActive = model.IsActive; md.CreateBy = base.UserId; md.CreateDate = DateTime.Now; md.Deleted = false; await _context.ReligionRepository.AddAsync(md).ConfigureAwait(true); await _context.SaveChangesAsync(); _memoryCachingService.Remove(CacheKey); } catch (Exception ex) { throw ex; } return(response); }
public void save(Religion Religion) { try { using (var context = new SmsMisDB()) { Religion.AddDateTime = DateTime.Now; var entry = context.Entry(Religion); if (entry != null) { if (Religion.ReligionCode == 0) { Religion.ReligionCode = Functions.getNextPk("Religion", Religion.ReligionCode, 0); entry.State = EntityState.Added; } else { entry.State = EntityState.Modified; } context.SaveChanges(); } } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { //throw ex; } catch (Exception ex) { // throw ex; } }
public async Task <ResponseModel> Delete(ReligionModel model) { ResponseModel response = new ResponseModel(); try { Religion md = await _context.ReligionRepository.FirstOrDefaultAsync(m => m.Id == model.Id); if (!md.RowVersion.SequenceEqual(model.RowVersion)) { response.ResponseStatus = Core.CommonModel.Enums.ResponseStatus.OutOfDateData; return(response); } md.Deleted = true; md.UpdateBy = base.UserId; md.UpdateDate = DateTime.Now; _context.ReligionRepository.Update(md); await _context.SaveChangesAsync(); _memoryCachingService.Remove(CacheKey); } catch (Exception ex) { throw ex; } return(response); }
public void Delete(int Id) { Religion religion = _context.Religion.FirstOrDefault(p => p.ReligionId == Id); _context.Religion.Remove(religion); _context.SaveChanges(); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ReligionType")] Religion religion) { if (id != religion.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(religion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReligionExists(religion.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(religion)); }
public static bool Update(Religion religion) { bool isExecute = RepositoryManager.Religion_Repository.Update(religion); InvalidateCache(); return(isExecute); }
private void btnCapNhat_Click(object sender, EventArgs e) { using (var uow = new UnitOfWork()) { Religion update = uow.FindObject <Religion>(CriteriaOperator.Parse("ReligionID = ?", txtMaTonGiao.Text)); if (update != null) { update.ReligionName = txtTenTonGiao.Text; try { if (LaHopLe() == true) { update.Save(); uow.CommitChanges(); frmReligionList f = this.Tag as frmReligionList; f.RefreshData(); XtraMessageBox.Show("Cập nhật thành công", "THÔNG BÁO"); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "THÔNG BÁO"); } } } }
private void btnThem_Click(object sender, EventArgs e) { using (var uow = new UnitOfWork()) { Religion insert = new Religion(uow); insert.ReligionID = txtMaTonGiao.Text; insert.ReligionName = txtTenTonGiao.Text; try { if (LaHopLe() == true) { insert.Save(); uow.CommitChanges(); frmReligionList f = this.Tag as frmReligionList; f.RefreshData(); XtraMessageBox.Show("Thêm thành công", "THÔNG BÁO"); CleanForm(); } } catch (Exception ex) { Religion c = uow.FindObject <Religion>(CriteriaOperator.Parse("ReligionID = ?", txtMaTonGiao.Text)); if (c != null) { er.SetError(this, "Mã tôn giáo đã tồn tại!"); XtraMessageBox.Show("Mã tôn giáo đã tồn tại!!!", "THÔNG BÁO"); } else { XtraMessageBox.Show(ex.Message, "THÔNG BÁO"); } } } }
public async Task <IActionResult> Create([Bind("ReligionId,ReligionName")] Religion religion) { /*Check Session */ var page = "172"; var typeofuser = ""; var PermisionAction = ""; // CheckSession if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username"))) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } else { typeofuser = HttpContext.Session.GetString("TypeOfUserId"); PermisionAction = HttpContext.Session.GetString("PermisionAction"); if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false) { Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error); return(RedirectToAction("Index", "Home")); } } /*Check Session */ if (ModelState.IsValid) { _context.Add(religion); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(religion)); }
protected override EmployeeInfo Parse() { return(new EmployeeInfo { ID = ToInt(ID), EmployeeNumber = EmployeeNumber.ToString(), FirstName = FirstName.ToString(), LastName = LastName.ToString(), MI = MI.ToString(), Email = Email.ToString(), Password = Password.ToString(), Contact = Contact.ToString(), Address = Address.ToString(), Birthday = Birthday.ToString(), Gender = Gender.ToString(), Religion = Religion.ToString(), Nationality = Nationality.ToString(), Birthplace = Birthplace.ToString(), CivilStatus = CivilStatus.ToString(), EmployeeStatusID = ToInt(EmployeeStatusID), DateHired = DateHired.ToString(), DateCreated = DateCreated.ToString(), DatedUpdated = DatedUpdated.ToString(), DatedDeleted = DatedDeleted.ToString(), RoleID = ToInt(RoleID), EmployeeStatus = EmployeeStatus.ToString(), RoleStatus = RoleStatus.ToString() }); }
public async Task <IActionResult> Edit(short id, [Bind("ReligionId,ReligionName")] Religion religion) { try { if (id != religion.ReligionId) { return(NotFound()); } // Préparation de l'appel à l'API string accessToken = await HttpContext.GetTokenAsync("access_token"); HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); if (ModelState.IsValid) { // Préparation de la requête update à l'API StringContent httpContent = new StringContent(religion.ToJson(), Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PutAsync(_configuration["URLAPI"] + $"api/Religions/{id}", httpContent); if (response.StatusCode != HttpStatusCode.NoContent) { return(BadRequest()); } return(RedirectToAction(nameof(Index))); } return(View(religion)); } catch (HttpRequestException) { return(Unauthorized()); } }
// GET: Religions/Details/5 public async Task <IActionResult> Details(short?id) { try { if (id == null) { return(NotFound()); } // Préparation de l'appel à l'API string accessToken = await HttpContext.GetTokenAsync("access_token"); HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); // Récurération des données et convertion des données dans le bon type string content = await client.GetStringAsync(_configuration["URLAPI"] + $"api/Religions/{id}"); Religion religion = JsonConvert.DeserializeObject <Religion>(content); if (religion == null) { return(NotFound()); } return(View(religion)); } catch (HttpRequestException) { return(Unauthorized()); } }
public override int GetHashCode() { int result = 1; result = (result * 397) ^ (AltEmailAddress != null ? AltEmailAddress.GetHashCode() : 0); result = (result * 397) ^ (AltTelephoneContact != null ? AltTelephoneContact.GetHashCode() : 0); result = (result * 397) ^ (CreatedOn != null ? CreatedOn.GetHashCode() : 0); result = (result * 397) ^ (DateOfBirth != null ? DateOfBirth.GetHashCode() : 0); result = (result * 397) ^ (EmailAddress != null ? EmailAddress.GetHashCode() : 0); result = (result * 397) ^ (Gender != null ? Gender.GetHashCode() : 0); result = (result * 397) ^ (GivenName != null ? GivenName.GetHashCode() : 0); result = (result * 397) ^ (HomeLanguage != null ? HomeLanguage.GetHashCode() : 0); result = (result * 397) ^ Id.GetHashCode(); result = (result * 397) ^ (LastModified != null ? LastModified.GetHashCode() : 0); result = (result * 397) ^ (MaritalStatus != null ? MaritalStatus.GetHashCode() : 0); result = (result * 397) ^ (NextOfKinAddress != null ? NextOfKinAddress.GetHashCode() : 0); result = (result * 397) ^ (NextOfKinContact != null ? NextOfKinContact.GetHashCode() : 0); result = (result * 397) ^ (NextOfKinName != null ? NextOfKinName.GetHashCode() : 0); result = (result * 397) ^ (NextOfKinRelationship != null ? NextOfKinRelationship.GetHashCode() : 0); result = (result * 397) ^ (Occupation != null ? Occupation.GetHashCode() : 0); result = (result * 397) ^ (Organisation != null ? Organisation.GetHashCode() : 0); result = (result * 397) ^ (OtherName != null ? OtherName.GetHashCode() : 0); result = (result * 397) ^ (PermentAddress != null ? PermentAddress.GetHashCode() : 0); result = (result * 397) ^ (PersonOwnerType != null ? PersonOwnerType.GetHashCode() : 0); result = (result * 397) ^ (PlaceOfBirth != null ? PlaceOfBirth.GetHashCode() : 0); result = (result * 397) ^ (PostalAddress != null ? PostalAddress.GetHashCode() : 0); result = (result * 397) ^ (PreferredLanguage != null ? PreferredLanguage.GetHashCode() : 0); result = (result * 397) ^ (ProfilePhotoName != null ? ProfilePhotoName.GetHashCode() : 0); result = (result * 397) ^ (Religion != null ? Religion.GetHashCode() : 0); result = (result * 397) ^ (Surname != null ? Surname.GetHashCode() : 0); result = (result * 397) ^ (TelephoneContact != null ? TelephoneContact.GetHashCode() : 0); result = (result * 397) ^ (Title != null ? Title.GetHashCode() : 0); result = (result * 397) ^ (WebsiteUrl != null ? WebsiteUrl.GetHashCode() : 0); return(result); }
public List <ReligionResult> ReligionResults(Religion religions) { List <ReligionResult> religion = new List <ReligionResult>(); using (IDbConnection db = GetConnection()) { try { db.Open(); if (religions.ReligionName != "") { var p = new DynamicParameters(); p.Add("@TableName", TableName.Religion.ToString(), DbType.String, ParameterDirection.Input); p.Add("@Parameter", religions.ReligionName, DbType.String, ParameterDirection.Input); religion = db.Query <ReligionResult>("usp_Read_Single_Row_From_Table", p, commandType: CommandType.StoredProcedure).ToList(); } } catch { } return(religion.ToList()); } }
public Task <int> PostReligionsUpdate(Religion ReligionsresultsUpdate) { int result = 0; using (IDbConnection db = GetConnection()) { try { db.Open(); if (ReligionsresultsUpdate.ReligionName != "") { var p = new DynamicParameters(); p.Add("@ReligionId", ReligionsresultsUpdate.ReligionId, DbType.Int32, ParameterDirection.Input); p.Add("@ReligionName", ReligionsresultsUpdate.ReligionName, DbType.String, ParameterDirection.Input); p.Add("@ReligionCreatedDate", ReligionsresultsUpdate.ReligionCreatedDate, DbType.DateTime, ParameterDirection.Input); p.Add("@ReligionCreatedBy", ReligionsresultsUpdate.ReligionCreatedBy, DbType.Int32, ParameterDirection.Input); p.Add("@ReligionModifiedDate", ReligionsresultsUpdate.ReligionModifiedDate, DbType.DateTime, ParameterDirection.Input); p.Add("@ReligionModifiedBy", ReligionsresultsUpdate.ReligionModifiedBy, DbType.Int32, ParameterDirection.Input); p.Add("@ReligionStatus", ReligionsresultsUpdate.ReligionStatus, DbType.Int32, ParameterDirection.Input); p.Add("@ActionType", ActionType.ReligionUpdate.ToString(), DbType.String, ParameterDirection.Input); p.Add("@OutputData", ReligionsresultsUpdate.ReligionModifiedBy, DbType.Int32, ParameterDirection.Output); result = db.Execute("usp_CRED_Religion", p, commandType: CommandType.StoredProcedure); } } catch (Exception ex) { throw; } } return(Task.FromResult(result)); }
public ActionResult DeleteConfirmed(int id) { Religion religion = Service.GetById(id); Service.Delete(religion); return(RedirectToAction("Index")); }
/// <summary> /// Method to add religion - SS /// </summary> /// <param name="name">name of religion</param> /// <param name="instituteId">institute id</param> /// <returns>message</returns> public async Task <SharedLookUpResponse> AddReligionAsync(AddReligionManagementAc addReligion, int instituteId) { if (!await _iMSDbContext.Religions.AnyAsync(x => x.InstituteId == instituteId && x.Code.ToLowerInvariant() == addReligion.Code.ToLowerInvariant())) { var religion = new Religion() { CreatedOn = DateTime.UtcNow, InstituteId = instituteId, Name = addReligion.Name, Code = addReligion.Code, Description = addReligion.Description, Status = true }; _iMSDbContext.Religions.Add(religion); await _iMSDbContext.SaveChangesAsync(); return(new SharedLookUpResponse() { HasError = false, Message = "Religion added successfully" }); } else { return new SharedLookUpResponse() { HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Religion with the same code is already exist" } }; }
public static int Insert(Religion religion) { int id = RepositoryManager.Religion_Repository.Insert(religion); InvalidateCache(); return(id); }
public async Task <ActionResult <Religion> > PostReligion(Religion religion) { _context.Religions.Add(religion); await _context.SaveChangesAsync(); return(CreatedAtAction("GetReligion", new { id = religion.ReligionId }, religion)); }
private void cleanForm() { FormUtils.clearTextbox(textControls()); selectedReligion = null; btnSaveModify.Text = "Guardar"; chbStatus.Checked = true; }
private void btnReligionName_Click(object sender, EventArgs e) { if (_context.Religions.Where(j => j.Name == cbxReligionName.Text).Select(s => s.ReligionID).Count() == 0) { if (cbxReligionName.Text == "") { } else { var queryReligion = new Religion(); queryReligion.Name = cbxReligionName.Text; queryReligion.TotalReligiousDays = 0; _context.Religions.AddObject(queryReligion); _context.SaveChanges(); MessageBox.Show("You have successfully added new religion to database.", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); RefreshDates(); } } else { MessageBox.Show("Allready exist. "); } }
public bool Update(Religion Religion) { bool isInsert = false; bool isUpate = false; try { db = EnterpriseLibraryContainer.Current.GetInstance <Database>(); DbCommand cmd = db.GetStoredProcCommand("ReligionUpdate"); db = AddParam(db, cmd, Religion, isInsert); int rowAffected = db.ExecuteNonQuery(cmd); if (rowAffected > 0) { isUpate = true; } } catch (Exception ex) { throw ex; } return(isUpate); }
public async Task <IActionResult> PutReligion(short id, Religion religion) { if (id != religion.ReligionId) { return(BadRequest()); } _context.Entry(religion).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReligionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public int Insert(Religion Religion) { int id = 0; bool isInsert = true; try { db = EnterpriseLibraryContainer.Current.GetInstance <Database>(); DbCommand cmd = db.GetStoredProcCommand("ReligionInsert"); db = AddParam(db, cmd, Religion, isInsert); db.ExecuteNonQuery(cmd); Object obj = db.GetParameterValue(cmd, "Id"); if (obj != null) { int.TryParse(obj.ToString(), out id); } } catch (Exception ex) { throw ex; } return(id); }
public JSBachsCathedral() : base(40) { Name = "J.S.Bach's Cathedral"; RequiredTech = new Religion(); ObsoleteTech = null; SetSmallIcon(6, 3); Type = Wonder.JSBachsCathedral; }
public MichelangelosChapel() : base(30) { Name = "Michelangelo's Chapel"; RequiredTech = new Religion(); ObsoleteTech = new Communism(); SetSmallIcon(5, 4); Type = Wonder.MichelangelosChapel; }
void UserProfile_ItemLoad() { if (!string.IsNullOrEmpty(CountryIso)) { Country c = new Country(core, CountryIso); countryName = c.Name; } if (ReligionId > 0) { Religion r = new Religion(core, ReligionId); religionTitle = r.Title; } }
partial void Religions_Updating(Religion entity) { entity.UpdateDate = DateTime.Now; entity.UpdateUser = Application.User.Name; }
private List<Law> FilterLaws( Culture cul, Religion rel, IEnumerable<Law> lawList ) { List<Law> posLaws = new List<Law>(); foreach( Law sc in lawList ) { if( sc.BannedCultures.Contains( cul.Name ) || sc.BannedCultures.Contains( cul.Group.Name ) ) continue; if( sc.BannedReligions.Contains( rel.Name ) || sc.BannedReligions.Contains( rel.Group.Name ) ) continue; if( sc.AllowedCultures.Count > 0 ) if( !sc.AllowedCultures.Contains( cul.Name ) && !sc.AllowedCultures.Contains( cul.Group.Name ) ) continue; if( sc.AllowedReligions.Count > 0 ) if( !sc.AllowedReligions.Contains( rel.Name ) && !sc.AllowedReligions.Contains( rel.Group.Name ) ) continue; posLaws.Add( sc ); } return posLaws; }
private bool IsMuslimLaw( Culture cul, Religion rel ) { bool retVal = ParentRuleSet.MuslimLawFollowers.Contains( cul.Name ); if( ParentRuleSet.MuslimLawFollowers.Contains( cul.Group.Name ) ) retVal = true; if( ParentRuleSet.MuslimLawFollowers.Contains( rel.Name ) ) retVal = true; if( ParentRuleSet.MuslimLawFollowers.Contains( rel.Group.Name ) ) retVal = true; return retVal; }
public LawSet GetLawSet( Culture cul, Religion rel, Random rand ) { LawSet ls = new LawSet(); List<Law> posLaws = FilterLaws( cul, rel, SuccessionLaws ); ls.Succession = posLaws.RandomItem( rand ).Name; posLaws = FilterLaws( cul, rel, GenderLaws ); ls.Gender = posLaws.RandomItem( rand ).Name; ls.CrownAuthority = "centralization_" + rand.Normal( 0, 4 ).ToString(); ls.CityLevy = "city_contract_" + WeightedLawNum( rand ).ToString(); ls.CityTax = "city_tax_" + WeightedLawNum( rand ).ToString(); if( IsMuslimLaw( cul, rel ) ) { ls.isMuslim = true; ls.IqtaLevy = "iqta_contract_" + WeightedLawNum( rand ).ToString(); ls.IqtaTax = "iqta_tax_" + WeightedLawNum( rand ).ToString(); } else { ls.isMuslim = false; ls.ChurchLevy = "temple_contract_" + WeightedLawNum( rand ).ToString(); ls.ChurchTax = "temple_tax_" + WeightedLawNum( rand ).ToString(); ls.FeudalLevy = "feudal_contract_" + WeightedLawNum( rand ).ToString(); ls.FeudalTax = "feudal_tax_" + WeightedLawNum( rand ).ToString(); } return ls; }
public Gender GetGender( Culture cul, Religion rel ) { if( MaleCultures.Contains( cul.Name ) || MaleCultures.Contains( cul.Group.Name ) ) return Gender.Male; if( MaleReligions.Contains( rel.Name ) || MaleReligions.Contains( rel.Group.Name ) ) return Gender.Male; if( FemaleCultures.Contains( cul.Name ) || FemaleCultures.Contains( cul.Group.Name ) ) return Gender.Female; if( FemaleReligions.Contains( rel.Name ) || FemaleReligions.Contains( rel.Group.Name ) ) return Gender.Female; return Gender.Random; }