Exemple #1
0
        public void SaveDistributorDeal(DistributorManagementModel modelTosave, int DistributorId, int ProductId, int CreatedBy)
        {
            Air_BranchDistributorDealAssociations datamodel = new Air_BranchDistributorDealAssociations();

            datamodel.DistributorId = DistributorId;
            datamodel.ProductId     = ProductId;
            if (ProductId == 1)
            {
                datamodel.BranchDealMasterId = modelTosave.MasterDealIdOfAirlines;
            }
            else if (ProductId == 2)
            {
                datamodel.BranchDealMasterId = modelTosave.MasterDealIdOfHotel;
            }
            else if (ProductId == 3)
            {
                datamodel.BranchDealMasterId = modelTosave.MasterDealIdOfMobile;
            }
            else if (ProductId == 4)
            {
                datamodel.BranchDealMasterId = modelTosave.MasterDealIdOfBus;
            }

            datamodel.CreatedBy   = CreatedBy;
            datamodel.CreatedDate = DateTime.Now;
            entityModel.AddToAir_BranchDistributorDealAssociations(datamodel);
            entityModel.SaveChanges();
        }
Exemple #2
0
        public void UpdateDistributorDeal(DistributorManagementModel model, int ProductID, int DistributorID)
        {
            Air_BranchDistributorDealAssociations tu = entityModel.Air_BranchDistributorDealAssociations.Where(u => u.DistributorId == DistributorID && u.ProductId == ProductID).FirstOrDefault();

            if (tu != null)
            {
                if (ProductID == 1)
                {
                    tu.BranchDealMasterId = model.MasterDealIdOfAirlines;
                }
                else if (ProductID == 2)
                {
                    tu.BranchDealMasterId = model.MasterDealIdOfHotel;
                }
                else if (ProductID == 3)
                {
                    tu.BranchDealMasterId = model.MasterDealIdOfMobile;
                }
                else if (ProductID == 4)
                {
                    tu.BranchDealMasterId = model.MasterDealIdOfBus;
                }


                entityModel.ApplyCurrentValues(tu.EntityKey.EntitySetName, tu);
                entityModel.SaveChanges();
            }
        }
Exemple #3
0
 public void DeleteBranchDistributorAgent(int id, int productid)
 {
     if (entityModel.Air_BranchDistributorDealAssociations.Where(x => x.DistributorId == id && x.ProductId == productid).Count() > 0)
     {
         Air_BranchDistributorDealAssociations datatodelete = entityModel.Air_BranchDistributorDealAssociations.First(m => m.DistributorId == id && m.ProductId == productid);
         entityModel.DeleteObject(datatodelete);
         entityModel.SaveChanges();
     }
 }
Exemple #4
0
        public bool CheckIFDealExistForBranchDistributor(int DistributorId, int productid)
        {
            Air_BranchDistributorDealAssociations deal = entityModel.Air_BranchDistributorDealAssociations.Where(u => u.DistributorId == DistributorId && u.ProductId == productid).FirstOrDefault();

            if (deal != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
        public void SaveBranchDistributorAgent(AgentSettingModel modelTosave, int agentid, int ProductId, int CreatedBy)
        {
            Air_BranchDistributorDealAssociations datamodel = new Air_BranchDistributorDealAssociations();

            datamodel.DistributorId = modelTosave.DistributorId ?? 0;
            datamodel.ProductId     = ProductId;
            if (ProductId == 1)
            {
                datamodel.BranchDealMasterId = modelTosave.MasterDealIdOfAirlines;
            }
            else if (ProductId == 2)
            {
                datamodel.BranchDealMasterId = modelTosave.MasterDealIdOfHotel;
            }
            datamodel.CreatedBy   = CreatedBy;
            datamodel.CreatedDate = DateTime.Now;
            entityModel.AddToAir_BranchDistributorDealAssociations(datamodel);
            entityModel.SaveChanges();
        }
Exemple #6
0
        public void UpdateBranchDistributorAgent(AgentSettingModel model, int ProductID, int AgentId)
        {
            Air_BranchDistributorDealAssociations tu = entityModel.Air_BranchDistributorDealAssociations.Where(u => u.DistributorId == AgentId && u.ProductId == ProductID).FirstOrDefault();

            if (tu != null)
            {
                if (ProductID == 1)
                {
                    tu.BranchDealMasterId = model.MasterDealIdOfAirlines;
                }
                else if (ProductID == 2)
                {
                    tu.BranchDealMasterId = model.MasterDealIdOfHotel;
                }

                entityModel.ApplyCurrentValues(tu.EntityKey.EntitySetName, tu);
                entityModel.SaveChanges();
            }
        }