示例#1
0
        public ActionResult Tracker(ClsTracker objTracker)
        {
            try
            {
                GetPagePermissionResult objPermission = Functions.CheckPagePermission(PageMaster.Tracker);
                if (!objPermission.IsActive)
                {
                    return(this.RedirectToAction("Logout", "Home"));
                }

                if (objTracker.inId == 0)
                {
                    if (!objPermission.Add_Right)
                    {
                        return(this.RedirectToAction("PermissionRedirectPage", "Home"));
                    }
                }
                else
                {
                    if (!objPermission.Edit_Right)
                    {
                        return(this.RedirectToAction("PermissionRedirectPage", "Home"));
                    }
                }

                if (objTracker.hdniFrame)
                {
                    this.ViewData["iFrame"] = "iFrame";
                }

                string strErrorMsg = this.ValidateTracker(objTracker);
                if (!string.IsNullOrEmpty(strErrorMsg))
                {
                    this.ViewData["Success"] = "0";
                    this.ViewData["Message"] = strErrorMsg;
                }
                else
                {
                    var carFleet = objiClsCarFleet.GetCarFleetByCarFleetId((long)objTracker.inCarId);
                    objTracker.inId = this.objiClsTracker.SaveTracker(objTracker, carFleet);
                    if (objTracker.inId > 0)
                    {
                        this.ViewData["Success"] = "1";
                        this.ViewData["Message"] = Functions.AlertMessage("Tracker", MessageType.Success);
                        this.BindDropDownListForTracker(objTracker, true);
                        return(this.View(objTracker));
                    }
                    else
                    {
                        this.ViewData["Success"] = "0";
                        this.ViewData["Message"] = Functions.AlertMessage("Tracker", MessageType.Fail);
                    }
                }

                #region Menu Access
                Controllers.BaseController baseController = new Controllers.BaseController();
                this.ViewData = baseController.MenuAccessPermissions(objPermission);
                #endregion Menu Access

                this.ViewData["UserRoleID"] = mySession.Current.RoleId;
                this.BindDropDownListForTracker(objTracker, true);
                return(this.View(objTracker));
            }
            catch (Exception ex)
            {
                this.ViewData["Success"] = "0";
                this.ViewData["Message"] = Functions.AlertMessage("Tracker", MessageType.Fail);
                Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.Tracker, mySession.Current.UserId);
                return(this.View(objTracker));
            }
        }
 public IClsCarFleet GetCarFleetByCarFleetId(long carFleetId)
 {
     return(_carFleet.GetCarFleetByCarFleetId(carFleetId));
 }