public void UpdateBranchDistributorDeal(AgentSettingModel model, int ProductID, int AgentId) { Air_DistributorAgentDealAssociations tu = entityModel.Air_DistributorAgentDealAssociations.Where(u => u.AgentId == AgentId && u.ProductId == ProductID).FirstOrDefault(); if (tu != null) { if (ProductID == 1) { tu.DistributorDealMasterId = model.MasterDealIdOfAirlines; } else if (ProductID == 2) { tu.DistributorDealMasterId = model.MasterDealIdOfHotel; } else if (ProductID == 3) { tu.DistributorDealMasterId = model.MasterDealIdOfMobile; } else if (ProductID == 4) { tu.DistributorDealMasterId = model.MasterDealIdOfBus; } entityModel.ApplyCurrentValues(tu.EntityKey.EntitySetName, tu); entityModel.SaveChanges(); } }
public void SaveBranchDistributorAgentDeal(AgentSettingModel modelTosave, int agentid, int ProductId, int CreatedBy) { Air_DistributorAgentDealAssociations datamodel = new Air_DistributorAgentDealAssociations(); datamodel.AgentId = agentid; datamodel.ProductId = ProductId; if (ProductId == 1) { datamodel.DistributorDealMasterId = modelTosave.MasterDealIdOfAirlines; } else if (ProductId == 2) { datamodel.DistributorDealMasterId = modelTosave.MasterDealIdOfHotel; } else if (ProductId == 3) { datamodel.DistributorDealMasterId = modelTosave.MasterDealIdOfMobile; } else if (ProductId == 4) { datamodel.DistributorDealMasterId = modelTosave.MasterDealIdOfBus; } datamodel.CreatedBy = CreatedBy; datamodel.CreatedDate = DateTime.Now; entityModel.AddToAir_DistributorAgentDealAssociations(datamodel); entityModel.SaveChanges(); }
public void DeleteAir_DistributorAgentDealAssociations(int id, int productid) { if (entityModel.Air_DistributorAgentDealAssociations.Where(x => x.AgentId == id && x.ProductId == productid).Count() > 0) { Air_DistributorAgentDealAssociations datatodelete = entityModel.Air_DistributorAgentDealAssociations.First(m => m.AgentId == id && m.ProductId == productid); entityModel.DeleteObject(datatodelete); entityModel.SaveChanges(); } }
public bool CheckIFDealExistForBranchsDistributor(int AgentID, int productid) { Air_DistributorAgentDealAssociations deal = entityModel.Air_DistributorAgentDealAssociations.Where(u => u.AgentId == AgentID && u.ProductId == productid).FirstOrDefault(); if (deal != null) { return(true); } else { return(false); } }