Example #1
0
        public void SaveAgentDeal(AgentSettingModel modelTosave, int agentid, int ProductId, int CreatedBy)
        {
            Core_AgentsDeals datamodel = new Core_AgentsDeals();

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

            datamodel.CreatedBy   = CreatedBy;
            datamodel.CreatedDate = DateTime.Now;
            entityModel.AddToCore_AgentsDeals(datamodel);
            entityModel.SaveChanges();
        }
Example #2
0
        public void UpdateDeal(AgentSettingModel model, int ProductID, int AgentId)
        {
            Core_AgentsDeals tu = entityModel.Core_AgentsDeals.Where(u => u.AgentId == AgentId && u.ProductId == ProductID).FirstOrDefault();

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

                entityModel.ApplyCurrentValues(tu.EntityKey.EntitySetName, tu);
                entityModel.SaveChanges();
            }
        }
Example #3
0
 public void DeleteAgentDeal(int id, int productid)
 {
     if (entityModel.Core_AgentsDeals.Where(x => x.AgentId == id && x.ProductId == productid).Count() > 0)
     {
         Core_AgentsDeals datatodelete = entityModel.Core_AgentsDeals.First(m => m.AgentId == id && m.ProductId == productid);
         entityModel.DeleteObject(datatodelete);
         entityModel.SaveChanges();
     }
 }
Example #4
0
        public bool CheckIFDealExistForAgent(int AgentID, int productid)
        {
            Core_AgentsDeals deal = entityModel.Core_AgentsDeals.Where(u => u.AgentId == AgentID && u.ProductId == productid).FirstOrDefault();

            if (deal != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #5
0
        public void SaveAgentDeal(AgencyModel modelTosave, int agentid, int ProductId)
        {
            Core_AgentsDeals datamodel = new Core_AgentsDeals();

            datamodel.AgentId   = agentid;
            datamodel.ProductId = ProductId;
            if (ProductId == 1)
            {
                datamodel.MasterDealId = modelTosave.MasterDealIdOfAirlines;
            }
            else if (ProductId == 2)
            {
                datamodel.MasterDealId = modelTosave.MasterDealIdOfHotel;
            }

            datamodel.CreatedBy   = modelTosave.CreatedBy;
            datamodel.CreatedDate = modelTosave.CreatedDate;


            ent.AddToCore_AgentsDeals(datamodel);
            ent.SaveChanges();
        }