コード例 #1
0
        public void EditBranchOfficeManagement(BranchOfficeManagementModel model)
        {
            BranchOffices result = ent.BranchOffices.Where(x => x.BranchOfficeId == model.BranchOfficeId).FirstOrDefault();

            model.BranchOfficeCode  = result.BranchOfficeCode;
            result.BranchOfficeId   = model.BranchOfficeId;
            result.BranchOfficeName = model.BranchOffice;
            result.NativeCountryId  = model.NativeCountry;
            result.ZoneId           = model.Zone;
            result.DistrictId       = model.District;
            result.Address          = model.Address;
            result.Phone            = model.Phone;
            result.Email            = model.Email;
            result.FaxNo            = model.Fax;
            result.PanNo            = model.PanNo;
            result.Web           = model.Web;
            result.Status        = Convert.ToBoolean(model.status);
            result.TimeZoneId    = model.TimeZone;
            result.isSystem      = model.isSystem;
            result.UpdatedBy     = model.UpdatedBy;
            result.UpdatedDate   = DateTime.UtcNow;
            result.BranchClassId = model.BranchClassId;

            ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
            ent.SaveChanges();

            UpdateGeneralLegder(model);
        }
コード例 #2
0
        public ActionResult Create()
        {
            BranchOfficeManagementModel model = new BranchOfficeManagementModel();
            TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];

            try
            {
                model.NativeCountryList = new SelectList(_repAgManagement.GetCountry(), "CountryId", "CountryName", 0);
                model.StatusList        = new SelectList(_repAgManagement.GetStatus(), "id", "Name", 1);
                model.ZoneList          = new SelectList(_repAgManagement.GetZoneList(), "ZoneId", "ZoneName");
                model.DistrictList      = new SelectList(_repAgManagement.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName");
                model.TimeZoneList      = new SelectList(_repAgManagement.GetTimeZoneList(), "RecordID", "StandardName", 66);


                model.MasterDealNameListOfAirlines = provider.GetBranchAllDealListOfAirlines();
                model.MasterDealNameListOfHotels   = provider.GetAllDealListOfHotel();
                model.MasterDealNameListOfBus      = provider.GetAllDealListOfBus();
                model.MasterDealNameListOfMobile   = provider.GetAllDealListOfMobile();

                ViewData["branchClass"] = new SelectList(provider.GetBranchClass(), "BranchClassId", "BranchClassName");
                model.BranchClassId     = provider.GeBranchClass(obj.LoginTypeId);
            }
            catch (Exception ex)
            {
                TempData["ActionResponse"] = ex.Message;
            }

            return(View(model));
        }
コード例 #3
0
        public void UpdateBranchDeal(BranchOfficeManagementModel model, int ProductID, int BranchOfficeId)
        {
            Air_AdminBranchDealAssociations tu = entityModel.Air_AdminBranchDealAssociations.Where(u => u.BranchOfficeId == BranchOfficeId && u.ProductId == ProductID).FirstOrDefault();

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


                entityModel.ApplyCurrentValues(tu.EntityKey.EntitySetName, tu);
                entityModel.SaveChanges();
            }
        }
コード例 #4
0
        public void Edit(int?id, BranchOfficeManagementModel model)
        {
            if (model.status == 0)
            {
                MembershipUser muUser = Membership.GetUser(model.UserName);
                pro.LockUserNow(model.UserName);
                Membership.UpdateUser(muUser);
            }
            else
            {
                MembershipUser muUser = Membership.GetUser(model.UserName);
                Membership.GetUser(model.UserName).UnlockUser();
                muUser.Email = model.Email;

                Membership.UpdateUser(muUser);

                UsersDetails usersDetails = ent.UsersDetails.Where(x => x.UserId == (Guid)muUser.ProviderUserKey).FirstOrDefault();
                if (usersDetails != null)
                {
                    usersDetails.MobileNumber = model.MobileNo;
                    usersDetails.PhoneNumber  = model.UserPhone;
                    usersDetails.UserAddress  = model.UserAddress;

                    ent.ApplyCurrentValues(usersDetails.EntityKey.EntitySetName, usersDetails);
                    ent.SaveChanges();
                }
            }

            EditBranchOfficeManagement(model);
        }
コード例 #5
0
        public int CreateBranchOfficeManagement(BranchOfficeManagementModel model)
        {
            int           BranchOfficeId = 0;
            BranchOffices obj            = new BranchOffices();

            obj.BranchOfficeName = model.BranchOffice;
            obj.NativeCountryId  = model.NativeCountry;
            obj.ZoneId           = model.Zone;
            obj.DistrictId       = model.District;
            obj.Address          = model.Address;
            obj.Phone            = model.Phone;
            obj.Email            = model.Email;
            obj.FaxNo            = model.Fax;
            obj.PanNo            = model.PanNo;
            obj.Web           = model.Web;
            obj.Status        = Convert.ToBoolean(model.status);
            obj.TimeZoneId    = model.TimeZone;
            obj.isSystem      = model.isSystem;
            obj.CreatedBy     = model.CreatedBy;
            obj.CreatedDate   = DateTime.UtcNow;
            obj.BranchClassId = model.BranchClassId;
            ent.AddToBranchOffices(obj);
            ent.SaveChanges();

            BranchOfficeId = obj.BranchOfficeId;
            string BranchOfficeCode = UpdateBranchOfficeCode(BranchOfficeId);

            return(BranchOfficeId);
        }
コード例 #6
0
        public ActionResult Edit(int id)
        {
            BranchOfficeManagementModel model = new BranchOfficeManagementModel();

            try
            {
                model = ser.BranchOfficeManagementDetail(id);
                model.NativeCountryList = new SelectList(_repAgManagement.GetCountry(), "CountryId", "CountryName", model.NativeCountry);
                model.StatusList        = new SelectList(_repAgManagement.GetStatus(), "id", "Name", model.status);
                model.ZoneList          = new SelectList(_repAgManagement.GetZoneList(), "ZoneId", "ZoneName", model.Zone);
                model.DistrictList      = new SelectList(_repAgManagement.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName", model.District);
                model.TimeZoneList      = new SelectList(_repAgManagement.GetTimeZoneList(), "RecordID", "StandardName", model.TimeZone);

                model.MasterDealIdOfAirlines = provider.GetBranchOfficeMasterDeal(id, 1) != null?provider.GetBranchOfficeMasterDeal(id, 1).DealMasterId : 0;

                model.MasterDealIdOfHotel = provider.GetBranchOfficeMasterDeal(id, 2) != null?provider.GetBranchOfficeMasterDeal(id, 2).DealMasterId : 0;

                model.MasterDealIdOfBus = provider.GetBranchOfficeMasterDeal(id, 4) != null?provider.GetBranchOfficeMasterDeal(id, 4).DealMasterId : 0;

                model.MasterDealIdOfMobile = provider.GetBranchOfficeMasterDeal(id, 3) != null?provider.GetBranchOfficeMasterDeal(id, 3).DealMasterId : 0;


                model.MasterDealNameListOfAirlines = provider.GetBranchAllDealListOfAirlines();
                model.MasterDealNameListOfHotels   = provider.GetAllDealListOfHotel();
                model.MasterDealNameListOfBus      = provider.GetAllDealListOfBus();
                model.MasterDealNameListOfMobile   = provider.GetAllDealListOfMobile();

                ViewData["branchClass"] = new SelectList(provider.GetBranchClass(), "BranchClassId", "BranchClassName");
                model.BranchClassId     = provider.GeBranchClass(id);
            }
            catch
            {
            }
            return(View(model));
        }
コード例 #7
0
        public void SaveBranchDeal(BranchOfficeManagementModel modelTosave, int BranchOfficeId, int ProductId, int CreatedBy)
        {
            Air_AdminBranchDealAssociations datamodel = new Air_AdminBranchDealAssociations();

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

            datamodel.CreatedBy   = CreatedBy;
            datamodel.CreatedDate = DateTime.Now;
            entityModel.AddToAir_AdminBranchDealAssociations(datamodel);
            entityModel.SaveChanges();
        }
コード例 #8
0
        public void UpdateGeneralLegder(BranchOfficeManagementModel model)
        {
            GL_Ledgers led = ent.GL_Ledgers.Where(x => x.Id == model.BranchOfficeId && x.AccTypeId == 8).FirstOrDefault();

            led.LedgerName = model.BranchOffice + " " + model.BranchOfficeCode;
            ent.ApplyCurrentValues(led.EntityKey.EntitySetName, led);
            ent.SaveChanges();
        }
コード例 #9
0
        public ActionResult Details(int id)
        {
            BranchOfficeManagementModel model = new BranchOfficeManagementModel();

            try
            {
                model = ser.BranchOfficeManagementDetail(id);
            }
            catch (Exception ex)
            {
                TempData["ActionResponse"] = ex.Message;
            }

            return(View(model));
        }
コード例 #10
0
        public BranchOfficeManagementModel BranchOfficeManagementDetail(int BranchOfficeId)
        {
            BranchOffices     result            = ent.BranchOffices.Where(x => x.BranchOfficeId == BranchOfficeId).FirstOrDefault();
            View_AgentDetails Agentadmindetails = _agentdetailsprovider.GetAgentAdminUser(BranchOfficeId);

            BranchOfficeManagementModel model = new BranchOfficeManagementModel();

            model.BranchOfficeId    = result.BranchOfficeId;
            model.BranchOfficeId    = result.BranchOfficeId;
            model.BranchOfficeCode  = result.BranchOfficeCode;
            model.BranchOffice      = result.BranchOfficeName;
            model.NativeCountry     = result.NativeCountryId;
            model.NativeCountryName = result.Countries.CountryName;
            model.Zone         = result.ZoneId;
            model.ZoneName     = result.Zones.ZoneName;
            model.District     = result.DistrictId;
            model.DistrictName = result.Districts.DistrictName;
            model.Address      = result.Address;
            model.Phone        = result.Phone;
            model.Email        = result.Email;
            model.Fax          = result.FaxNo;
            model.PanNo        = result.PanNo;
            model.Web          = result.Web;
            model.status       = Convert.ToInt32(result.Status);
            model.TimeZone     = result.TimeZoneId;
            model.isSystem     = result.isSystem;
            model.CreatedBy    = result.CreatedBy;
            model.CreatedDate  = result.CreatedDate;
            model.UpdatedBy    = result.UpdatedBy;
            model.UpdatedDate  = result.UpdatedDate;


            View_BranchDetails BranchUserDetail = GetBranchUserDetails(BranchOfficeId);

            if (BranchUserDetail != null)
            {
                model.FullName        = BranchUserDetail.FullName;
                model.UserName        = BranchUserDetail.UserName;
                model.UserEmail       = BranchUserDetail.Email;
                model.UserAddress     = BranchUserDetail.UserAddress;
                model.UserPhone       = BranchUserDetail.Phone;
                model.MobileNo        = BranchUserDetail.MobileNumber;
                model.Password        = BranchUserDetail.Password;
                model.ConfirmPassword = BranchUserDetail.Password;
            }

            return(model);
        }
コード例 #11
0
        private void CreateBranchOfficeUser(BranchOfficeManagementModel model, int p)
        {
            UserManagementProvider _usRep = new UserManagementProvider();

            UserManagementModel.CreateAspUser obj = new UserManagementModel.CreateAspUser();
            obj.UserName  = model.UserName;
            obj.Password  = model.Password;
            obj.Email     = model.UserEmail;
            obj.FullName  = model.FullName;
            obj.Address   = model.UserAddress;
            obj.MobileNo  = model.MobileNo;
            obj.PhoneNo   = model.UserPhone;
            obj.AgentId   = model.BranchOfficeId;
            obj.CreatedBy = model.CreatedBy;
            _usRep.CreateUser(obj, (int)ATLTravelPortal.Helpers.UserTypes.BranchUser);
        }
コード例 #12
0
        public ActionResult Index(int?IsActive, string id)
        {
            BranchOfficeManagementModel model = new BranchOfficeManagementModel();

            //  model.StatusList = new SelectList(_repAgManagement.GetStatus(), "id", "Name", 1);
            try
            {
                string alphabet = string.IsNullOrEmpty(id) ? "" : id;
                model.ListBranchOffice = ser.ListBranchOfficeManagement().Where(aa => aa.BranchOffice.StartsWith(alphabet)).ToList();

                bool status = IsActive == 1 ? true : false;

                if (Request.IsAjaxRequest())
                {
                    if (IsActive != 0 && id == "")
                    {
                        model.ListBranchOffice = model.ListBranchOffice.Where(aa => aa.status == Convert.ToInt32(status)).ToList();
                        return(PartialView("VUC_BranchOfficeList", model));
                    }
                    else if (IsActive == null && id != "")
                    {
                        return(PartialView("VUC_BranchOfficeList", model));
                    }
                    else if (IsActive == 0 && id != "")
                    {
                        return(PartialView("VUC_BranchOfficeList", model));
                    }
                    else
                    {
                        model.ListBranchOffice = model.ListBranchOffice.Where(aa => aa.status == Convert.ToInt32(status)).ToList();
                        return(PartialView("VUC_BranchOfficeList", model));
                    }
                }


                return(View(model));
            }
            catch (Exception ex)
            {
                TempData["ActionResponse"] = ex.Message;
                return(View(model));
            }
        }
コード例 #13
0
        public ActionResult Index(BranchOfficeManagementModel model)
        {
            try
            {
                if (model.BranchOffice != null)
                {
                    model.ListBranchOffice = ser.ListBranchOfficeManagement().Where(aa => (aa.BranchOffice.ToUpper().StartsWith(model.BranchOffice.ToUpper())) || (aa.BranchOfficeCode.ToUpper().StartsWith(model.BranchOffice.ToUpper()))).ToList();

                    return(View("Index", model));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
コード例 #14
0
        public int Create(BranchOfficeManagementModel model)
        {
            int BranchOfficeId = CreateBranchOfficeManagement(model);

            model.BranchOfficeId = BranchOfficeId;
            CreateBranchOfficeUser(model, (int)ATLTravelPortal.Helpers.UserTypes.User);
            MembershipUser mem      = Membership.GetUser(model.UserName);
            Guid           userGUId = new Guid(mem.ProviderUserKey.ToString());

            if (model.status == 0)
            {
                pro.LockUserNow(model.UserName);
                Membership.UpdateUser(mem);
            }
            int AppUserId = GetUserDetails(userGUId);

            SaveBranchOfficeLedger(model.BranchOfficeId, 1, model.CreatedBy);

            return(BranchOfficeId);
        }
コード例 #15
0
        public List <BranchOfficeManagementModel> GetBranchOfficeSearchResult(string BranchOfficeName)
        {
            var result = ent.BranchOffices.Where(x => (x.BranchOfficeName.Contains(BranchOfficeName)) || (x.BranchOfficeCode.Contains(BranchOfficeName)));
            List <BranchOfficeManagementModel> model = new List <BranchOfficeManagementModel>();

            foreach (var item in result)
            {
                BranchOfficeManagementModel obj = new BranchOfficeManagementModel
                {
                    BranchOfficeId    = item.BranchOfficeId,
                    BranchOfficeCode  = item.BranchOfficeCode,
                    BranchOffice      = item.BranchOfficeName,
                    NativeCountry     = item.NativeCountryId,
                    NativeCountryName = item.Countries.CountryName,
                    Zone         = item.ZoneId,
                    ZoneName     = item.Zones.ZoneName,
                    District     = item.DistrictId,
                    DistrictName = item.Districts.DistrictName,
                    Address      = item.Address,
                    Phone        = item.Phone,
                    Email        = item.Email,
                    Fax          = item.FaxNo,
                    PanNo        = item.PanNo,
                    Web          = item.Web,
                    status       = Convert.ToInt32(item.Status),
                    TimeZone     = item.TimeZoneId,
                    isSystem     = item.isSystem,
                    CreatedBy    = item.CreatedBy,
                    CreatedDate  = item.CreatedDate,
                    UpdatedBy    = item.UpdatedBy,
                    UpdatedDate  = item.UpdatedDate
                };
                model.Add(obj);
            }
            return(model);
        }
コード例 #16
0
        public ActionResult Edit(int id, BranchOfficeManagementModel model)
        {
            TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];

            model.BranchOfficeId = id;
            model.UpdatedBy      = obj.AppUserId;
            try
            {
                model.NativeCountryList = new SelectList(_repAgManagement.GetCountry(), "CountryId", "CountryName", model.NativeCountry);
                model.StatusList        = new SelectList(_repAgManagement.GetStatus(), "id", "Name", model.status);
                model.ZoneList          = new SelectList(_repAgManagement.GetZoneList(), "ZoneId", "ZoneName", model.Zone);
                model.DistrictList      = new SelectList(_repAgManagement.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName", model.District);
                model.TimeZoneList      = new SelectList(_repAgManagement.GetTimeZoneList(), "RecordID", "StandardName", model.TimeZone);


                model.MasterDealNameListOfAirlines = provider.GetBranchAllDealListOfAirlines();
                model.MasterDealNameListOfHotels   = provider.GetAllDealListOfHotel();
                model.MasterDealNameListOfBus      = provider.GetAllDealListOfBus();
                model.MasterDealNameListOfMobile   = provider.GetAllDealListOfMobile();

                ViewData["branchClass"] = new SelectList(provider.GetBranchClass(), "BranchClassId", "BranchClassName");



                if (ser.CheckEditDuplicateEmail(model.Email, id))
                {
                    TempData["ActionResponse"] = "Registration failed! Email already exists, please re-enter and try again";
                    model = ser.BranchOfficeManagementDetail(id);
                    model.NativeCountryList = new SelectList(_repAgManagement.GetCountry(), "CountryId", "CountryName", model.NativeCountry);
                    model.StatusList        = new SelectList(_repAgManagement.GetStatus(), "id", "Name", model.status);
                    model.ZoneList          = new SelectList(_repAgManagement.GetZoneList(), "ZoneId", "ZoneName", model.Zone);
                    model.DistrictList      = new SelectList(_repAgManagement.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName", model.District);
                    model.TimeZoneList      = new SelectList(_repAgManagement.GetTimeZoneList(), "RecordID", "StandardName", model.TimeZone);


                    model.MasterDealNameListOfAirlines = provider.GetBranchAllDealListOfAirlines();
                    model.MasterDealNameListOfHotels   = provider.GetAllDealListOfHotel();
                    model.MasterDealNameListOfBus      = provider.GetAllDealListOfBus();
                    model.MasterDealNameListOfMobile   = provider.GetAllDealListOfMobile();

                    ViewData["branchClass"] = new SelectList(provider.GetBranchClass(), "BranchClassId", "BranchClassName");
                    model.BranchClassId     = provider.GeBranchClass(id);
                    return(View(model));
                }
                else
                {
                    if (!string.IsNullOrEmpty(model.MobileNo) && !ser.CheckEditDuplicateMobileNumber(model.MobileNo, model.BranchOfficeId))
                    {
                        TempData["ActionResponse"] = "Registration failed! Mobile Number already exists, please re-enter and try again";
                        model = ser.BranchOfficeManagementDetail(id);
                        model.NativeCountryList = new SelectList(_repAgManagement.GetCountry(), "CountryId", "CountryName", model.NativeCountry);
                        model.StatusList        = new SelectList(_repAgManagement.GetStatus(), "id", "Name", model.status);
                        model.ZoneList          = new SelectList(_repAgManagement.GetZoneList(), "ZoneId", "ZoneName", model.Zone);
                        model.DistrictList      = new SelectList(_repAgManagement.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName", model.District);
                        model.TimeZoneList      = new SelectList(_repAgManagement.GetTimeZoneList(), "RecordID", "StandardName", model.TimeZone);


                        model.MasterDealNameListOfAirlines = provider.GetBranchAllDealListOfAirlines();
                        model.MasterDealNameListOfHotels   = provider.GetAllDealListOfHotel();
                        model.MasterDealNameListOfBus      = provider.GetAllDealListOfBus();
                        model.MasterDealNameListOfMobile   = provider.GetAllDealListOfMobile();

                        ViewData["branchClass"] = new SelectList(provider.GetBranchClass(), "BranchClassId", "BranchClassName");
                        model.BranchClassId     = provider.GeBranchClass(id);
                        return(View(model));
                    }

                    else
                    {
                        ser.Edit(id, model);
                        SaveOrUpdateBranchSetting(id, model, obj);
                        model.BranchClassId = provider.GeBranchClass(id);
                        return(RedirectToAction("Index"));
                    }
                }
            }
            catch (Exception ex)
            {
                TempData["ActionResponse"] = ex.Message;
                model = ser.BranchOfficeManagementDetail(id);

                model.NativeCountryList = new SelectList(_repAgManagement.GetCountry(), "CountryId", "CountryName", model.NativeCountry);
                model.StatusList        = new SelectList(_repAgManagement.GetStatus(), "id", "Name", model.status);
                model.ZoneList          = new SelectList(_repAgManagement.GetZoneList(), "ZoneId", "ZoneName", model.Zone);
                model.DistrictList      = new SelectList(_repAgManagement.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName", model.District);
                model.TimeZoneList      = new SelectList(_repAgManagement.GetTimeZoneList(), "RecordID", "StandardName", model.TimeZone);

                model.MasterDealNameListOfAirlines = provider.GetBranchAllDealListOfAirlines();
                model.MasterDealNameListOfHotels   = provider.GetAllDealListOfHotel();
                model.MasterDealNameListOfBus      = provider.GetAllDealListOfBus();
                model.MasterDealNameListOfMobile   = provider.GetAllDealListOfMobile();

                ViewData["branchClass"] = new SelectList(provider.GetBranchClass(), "BranchClassId", "BranchClassName");
                model.BranchClassId     = provider.GeBranchClass(id);

                return(View(model));
            }
        }
コード例 #17
0
        public ActionResult Create(BranchOfficeManagementModel model, FormCollection fc)
        {
            TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];

            model.CreatedBy = obj.AppUserId;

            model.Email = model.Email.Trim(';');

            model.NativeCountryList = new SelectList(_repAgManagement.GetCountry(), "CountryId", "CountryName", 0);
            model.StatusList        = new SelectList(_repAgManagement.GetStatus(), "id", "Name", 1);
            model.ZoneList          = new SelectList(_repAgManagement.GetZoneList(), "ZoneId", "ZoneName");
            model.DistrictList      = new SelectList(_repAgManagement.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName");
            model.TimeZoneList      = new SelectList(_repAgManagement.GetTimeZoneList(), "RecordID", "StandardName", 66);

            try
            {
                if (!ser.CheckDuplicateBranchName(model.BranchOffice))
                {
                    TempData["ErrorMessage"] = "Registration failed! Branch Name already exists, please re-enter and try again";
                    return(View("Create", model));
                }


                if (!ser.CheckDuplicateEmail(model.Email))
                {
                    TempData["ErrorMessage"] = "Registration failed! Email already exists, please re-enter and try again";
                    return(View("Create", model));
                }



                if (model.Password != model.ConfirmPassword)
                {
                    TempData["ErrorMessage"] = "Password and Confirm Password doesnot match, please re-enter and try again";
                    return(View("Create", model));
                }
                else
                {
                    if (!string.IsNullOrEmpty(model.MobileNo) && !_repAgManagement.CheckDuplicateMobileNumber(model.MobileNo))
                    {
                        TempData["ErrorMessage"] = "Registration failed! Mobile Number already exists, please re-enter and try again";
                        return(View("Create", model));
                    }
                    else
                    {
                        int branchofficeid = ser.Create(model);
                        model.MasterDealNameListOfAirlines = provider.GetBranchAllDealListOfAirlines();
                        model.MasterDealNameListOfHotels   = provider.GetAllDealListOfHotel();
                        model.MasterDealNameListOfBus      = provider.GetAllDealListOfBus();
                        model.MasterDealNameListOfMobile   = provider.GetAllDealListOfMobile();

                        ViewData["branchClass"] = new SelectList(provider.GetBranchClass(), "BranchClassId", "BranchClassName");
                        model.BranchClassId     = provider.GeBranchClass(obj.LoginTypeId);

                        SaveOrUpdateBranchSetting(branchofficeid, model, obj);

                        TempData["SuccessMessage"] = "Branch office created successfully .";
                        return(RedirectToAction("Index"));
                    }
                }
            }
            catch (Exception ex)
            {
                TempData["ActionResponse"] = ex.Message;
                model.NativeCountryList    = new SelectList(_repAgManagement.GetCountry(), "CountryId", "CountryName", 0);
                model.StatusList           = new SelectList(_repAgManagement.GetStatus(), "id", "Name", 1);
                model.ZoneList             = new SelectList(_repAgManagement.GetZoneList(), "ZoneId", "ZoneName");
                model.DistrictList         = new SelectList(_repAgManagement.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName");
                model.TimeZoneList         = new SelectList(_repAgManagement.GetTimeZoneList(), "RecordID", "StandardName", 66);

                return(View("Create", model));
            }
        }
コード例 #18
0
        public void SaveOrUpdateBranchSetting(int id, BranchOfficeManagementModel settingmodel, TravelSession obj)
        {
            if (settingmodel.MasterDealIdOfAirlines != 0)
            {
                bool result = provider.CheckIFDealExistForBranch(id, 1);
                if (result == true)
                {
                    provider.UpdateBranchDeal(settingmodel, 1, id);
                }
                else
                {
                    provider.SaveBranchDeal(settingmodel, id, 1, obj.AppUserId);
                }
            }
            else
            {
                provider.DeleteBranchDeal(id, 1);
            }

            if (settingmodel.MasterDealIdOfHotel != 0)
            {
                bool result = provider.CheckIFDealExistForBranch(id, 2);
                if (result == true)
                {
                    provider.UpdateBranchDeal(settingmodel, 2, id);
                }
                else
                {
                    provider.SaveBranchDeal(settingmodel, id, 2, obj.AppUserId);
                }
            }
            else
            {
                provider.DeleteBranchDeal(id, 2);
            }

            if (settingmodel.MasterDealIdOfBus != 0)
            {
                bool result = provider.CheckIFDealExistForBranch(id, 4);
                if (result == true)
                {
                    provider.UpdateBranchDeal(settingmodel, 4, id);
                }
                else
                {
                    provider.SaveBranchDeal(settingmodel, id, 4, obj.AppUserId);
                }
            }
            else
            {
                provider.DeleteBranchDeal(id, 4);
            }

            if (settingmodel.MasterDealIdOfMobile != 0)
            {
                bool result = provider.CheckIFDealExistForBranch(id, 3);
                if (result == true)
                {
                    provider.UpdateBranchDeal(settingmodel, 3, id);
                }
                else
                {
                    provider.SaveBranchDeal(settingmodel, id, 3, obj.AppUserId);
                }
            }
            else
            {
                provider.DeleteBranchDeal(id, 3);
            }
        }