Example #1
0
        //
        // GET: /Settings/
        public ActionResult Index()
        {
            ViewBag.Version = VersionUtil.GetFullVersionString();
            ServiceAvailability.Reload();

            return(View(new SettingsViewModel(Settings.ActiveSettings)));
        }
Example #2
0
        public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (MembershipService.ValidateUser(model.UserName, model.Password))
                {
                    FormsService.SignIn(model.UserName, model.RememberMe);
                    ServiceAvailability.Reload();
                    Log.Debug("User {0} logged in from host {1}", model.UserName, Request.UserHostAddress);
                    if (Url.IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", FormStrings.UsernamePasswordIncorrect);
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Example #3
0
        // **************************************
        // URL: /Account/LogOff
        // **************************************
        public ActionResult LogOff()
        {
            Log.Debug("User {0} logged out", HttpContext.User.Identity.Name);
            FormsService.SignOut();
            ServiceAvailability.Reload();

            return(RedirectToAction("Index", "Home"));
        }
Example #4
0
        public void IsOutOfHours_Dispo_Out_Of_Hours_And_Time_Frame_Out_Of_Hours_Test()
        {
            _mockServiceAvailabilityProfile
            .Setup(c => c.GetServiceAvailability(It.IsAny <DateTime>(), It.IsAny <int>()))
            .Returns(DispositionTimePeriod.DispositionAndTimeFrameOutOfHours);

            _serviceAvailability = new ServiceAvailability(_mockServiceAvailabilityProfile.Object, It.IsAny <DateTime>(), It.IsAny <int>());

            Assert.IsTrue(_serviceAvailability.IsOutOfHours);
        }
Example #5
0
        public void IsOutOfHours_Dispo_In_Hours_Shoulder_And_Time_Frame_In_Hours_Shoulder_Test()
        {
            _mockServiceAvailabilityProfile
            .Setup(c => c.GetServiceAvailability(It.IsAny <DateTime>(), It.IsAny <int>()))
            .Returns(DispositionTimePeriod.DispositionInShoulderTimeFrameInShoulder);

            _serviceAvailability = new ServiceAvailability(_mockServiceAvailabilityProfile.Object, It.IsAny <DateTime>(), It.IsAny <int>());

            Assert.IsFalse(_serviceAvailability.IsOutOfHours);
        }
        public SuperviseService(HostSettings settings, ServiceAvailability serviceAvailability,
                                ServiceBuilderFactory serviceBuilderFactory)
        {
            _settings              = settings;
            _serviceAvailability   = serviceAvailability;
            _serviceBuilderFactory = serviceBuilderFactory;

            _fiber     = new PoolFiber();
            _scheduler = new TimerScheduler(new PoolFiber());

            _commandHandlers = CreateCommandHandlers();
        }
 public ActionResult Services(ServiceAddressesViewModel model)
 {
     Configuration.WebMediaPortal.MASUrl          = model.MAS;
     Configuration.WebMediaPortal.TASUrl          = model.TAS;
     Configuration.WebMediaPortal.ServiceUsername = model.Username;
     Configuration.WebMediaPortal.ServicePassword = model.Password;
     Configuration.Save();
     Connections.SetUrls(model.MAS, model.TAS);
     Log.Info("WebMediaPortal version {0} now connected with MAS {1} and TAS {2}",
              VersionUtil.GetFullVersionString(), Settings.ActiveSettings.MASUrl, Settings.ActiveSettings.TASUrl);
     Connections.LogServiceVersions();
     ServiceAvailability.Reload();
     return(View("ServicesSaved"));
 }
Example #8
0
    private void LoadServiceDetail()
    {
        LoadCountry();

        ddlCourier.Focus();

        if (IsEditMode())
        {
            lblPopupTitle.Text = "Edit Service";

            var dtServiceAvailability = new Query()
            {
                ServiceAvailabilityId = lblServiceAvailabilityId.zToInt()
            }.Select(eSP.qry_ServiceAvailability);

            var objServiceAvailability = new ServiceAvailability()
            {
            }.SelectList <ServiceAvailability>(dtServiceAvailability.Select())[0];

            ddlCourier.SelectedValue = objServiceAvailability.CourierId.ToString();

            var dr = dtServiceAvailability.Rows[0];
            ddlCountry.SelectedValue = dr[CS.CountryId].ToString();

            LoadState();
            ddlState.SelectedValue = dr[CS.StateId].ToString();

            LoadCity();
            ddlCity.SelectedValue = dr[CS.CityId].ToString();

            txtPincode.Text = objServiceAvailability.Pincode;

            chkIsCODAvailable.Checked           = objServiceAvailability.eCOD == (int)eYesNo.Yes;
            chkIsPrepaidAvailable.Checked       = objServiceAvailability.ePrepaid == (int)eYesNo.Yes;
            chkIsReversePickupAvailable.Checked = objServiceAvailability.eReversePickup == (int)eYesNo.Yes;
            chkIsPickupAvailable.Checked        = objServiceAvailability.ePickup == (int)eYesNo.Yes;
        }
        else
        {
            lblPopupTitle.Text = "New Service";

            LoadState();
            LoadCity();

            txtPincode.Text           = string.Empty;
            chkIsCODAvailable.Checked = chkIsPrepaidAvailable.Checked = chkIsReversePickupAvailable.Checked = chkIsPickupAvailable.Checked = false;
        }
    }
Example #9
0
    private bool SaveData()
    {
        if (!IsValidate())
        {
            popupService.Show();
            return(false);
        }

        string Message = string.Empty;

        var objServiceAvailability = new ServiceAvailability()
        {
            CourierId      = ddlCourier.zToInt(),
            CityId         = ddlCity.zToInt(),
            Pincode        = txtPincode.Text,
            eCOD           = chkIsCODAvailable.Checked ? (int)eYesNo.Yes : (int)eYesNo.No,
            ePrepaid       = chkIsPrepaidAvailable.Checked ? (int)eYesNo.Yes : (int)eYesNo.No,
            eReversePickup = chkIsReversePickupAvailable.Checked ? (int)eYesNo.Yes : (int)eYesNo.No,
            ePickup        = chkIsPickupAvailable.Checked ? (int)eYesNo.Yes : (int)eYesNo.No,
        };

        if (IsEditMode())
        {
            objServiceAvailability.ServiceAvailabilityId = lblServiceAvailabilityId.zToInt();
            objServiceAvailability.Update();

            Message = "Service Detail Change Sucessfully.";
        }
        else
        {
            objServiceAvailability.eStatus = (int)eStatus.Active;
            objServiceAvailability.Insert();

            Message = "New Service Added Sucessfully.";
        }

        CU.ZMessage(eMsgType.Success, string.Empty, Message);

        return(true);
    }
Example #10
0
    private void InsertData(DataTable dt)
    {
        int UpdateCount = 0, InsertCount = 0;

        try
        {
            var lstInsertSA = new List <ServiceAvailability>();
            var lstUpdateSA = new List <ServiceAvailability>();
            var lstDeleteSA = new List <ServiceAvailability>();

            int CourierId = ddlCourierExcel.zToInt().Value;

            int  CountryId  = CU.GetCountryId("India");
            bool IsValidate = false;

            DataTable dtServiceAvailibility = new Query()
            {
                CourierId  = CourierId,
                eStatusNot = (int)eStatus.Delete
            }.Select(eSP.qry_ServiceAvailability);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                #region Value Initialization

                PincodeCol       = dt.Rows[i][PincodeColNo].ToString().Trim().TrimEnd(',');
                CityCol          = dt.Rows[i][CityColNo].ToString().Trim().TrimEnd(',');
                StateCol         = dt.Rows[i][StateColNo].ToString().Trim().TrimEnd(',');
                PrepaidCol       = dt.Rows[i][PrepaidColNo].ToString().Trim().TrimEnd(',').ToLower();
                CODCol           = dt.Rows[i][CODColNo].ToString().Trim().TrimEnd(',').ToLower();
                ReversePickupCol = dt.Rows[i][ReversePickupColNo].ToString().Trim().TrimEnd(',').ToLower();
                PickupCol        = dt.Rows[i][PickupColNo].ToString().Trim().TrimEnd(',').ToLower();

                #endregion

                int StateId = CU.GetStateId(CountryId, StateCol);
                int CityId  = CU.GetCityId(StateId, CityCol);

                var drServiceAvailibility = dtServiceAvailibility.Select(CS.Pincode + " = '" + PincodeCol + "'");

                var objServiceAvailability = new ServiceAvailability()
                {
                    ServiceAvailabilityId = drServiceAvailibility.Length > 0 ? drServiceAvailibility[0][CS.ServiceAvailabilityId].zToInt() : (int?)null,
                    CourierId             = CourierId,
                    Pincode        = PincodeCol,
                    CityId         = CityId,
                    ePrepaid       = (int)GeteYesNo(PrepaidCol, ref IsValidate),
                    eCOD           = (int)GeteYesNo(CODCol, ref IsValidate),
                    eReversePickup = (int)GeteYesNo(ReversePickupCol, ref IsValidate),
                    ePickup        = (int)GeteYesNo(PickupCol, ref IsValidate),
                };

                if (objServiceAvailability.ServiceAvailabilityId.HasValue)
                {
                    lstUpdateSA.Add(objServiceAvailability);
                    if (lstUpdateSA.Count >= 250)
                    {
                        lstUpdateSA.Update();
                        lstUpdateSA = new List <ServiceAvailability>();
                    }

                    UpdateCount++;
                }
                else
                {
                    objServiceAvailability.eStatus = (int)eStatus.Active;
                    lstInsertSA.Add(objServiceAvailability);
                    if (lstInsertSA.Count >= 250)
                    {
                        lstInsertSA.Insert();
                        lstInsertSA = new List <ServiceAvailability>();
                    }

                    InsertCount++;
                }
            }

            foreach (DataRow dr in dtServiceAvailibility.Rows)
            {
                lstDeleteSA.Add(new ServiceAvailability()
                {
                    ServiceAvailabilityId = dr[CS.ServiceAvailabilityId].zToInt()
                });
                if (lstDeleteSA.Count >= 250)
                {
                    lstDeleteSA.Delete();
                    lstDeleteSA = new List <ServiceAvailability>();
                }
            }

            lstUpdateSA.Update();
            lstInsertSA.Insert();
            lstDeleteSA.Delete();

            CU.SetSuccessExcelMessage(InsertCount, UpdateCount, "Service");
        }
        catch (Exception ex)
        {
            CU.ZMessage(eMsgType.Error, string.Empty, ex.Message, 0);
        }

        LoadServiceGrid(ePageIndex.Custom);
    }
Example #11
0
 public void AddServiceAvailability(ServiceAvailability serviceAvailability)
 {
     _fiber.Add(() => _serviceAvailability.Add(serviceAvailability));
 }
Example #12
0
 public void AddServiceAvailability(ServiceAvailability serviceAvailability)
 {
     _fiber.Add(() => _serviceAvailability.Add(serviceAvailability));
 }