コード例 #1
0
        private Tuple <Bitmap, SizeF> GetStreakCounterImage(int streakCount)
        {
            var font     = new Font("Tahoma", ComboService.GetPowerLevelFontSize(streakCount));
            var color    = ComboService.GetPowerLevelColor(streakCount);
            var penWidth = ComboService.GetPowerLevelPenWidth(streakCount);

            var bitmap = new Bitmap(ADORNMENT_WIDTH, ADORNMENT_STREAK_COUNTER_HEIGHT);

            bitmap.MakeTransparent();

            using (var graphics = Graphics.FromImage(bitmap))
            {
                graphics.SmoothingMode     = SmoothingMode.AntiAlias;
                graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                graphics.PixelOffsetMode   = PixelOffsetMode.HighQuality;

                var size = graphics.MeasureString(streakCount.ToString(), font);
                graphics.DrawString(streakCount.ToString(), font, new SolidBrush(color), new RectangleF(ADORNMENT_WIDTH - size.Width, 0, size.Width, ADORNMENT_STREAK_COUNTER_HEIGHT));

                var pen = new Pen(color, penWidth);
                graphics.DrawLine(pen, ADORNMENT_WIDTH - size.Width, size.Height - 5 + penWidth / 2, ADORNMENT_WIDTH, size.Height - 5 + penWidth / 2);

                graphics.Flush();

                return(new Tuple <Bitmap, SizeF>(bitmap, size));
            }
        }
コード例 #2
0
        public ActionResult ReloadProductList()
        {
            var cbService = new ComboService();
            var exService = new ExchequerService();
            var list      = exService.LstExchquerProduct(true);

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public void UpdateComboSide_NewSide_ShouldReplaceOldSide()
        {
            var combo        = new ChickenLittleCombo(new MashedPotato(), new Brownie());
            var comboService = new ComboService();

            comboService.UpdateComboSide(combo, new MacAndCheese());

            Assert.IsInstanceOfType(combo.Side, typeof(MacAndCheese));
        }
コード例 #4
0
        public ActionResult PurgeHistoryReport(CMSReportViewModels model, ServiceResult msgresult)
        {
            var uService = new UserService();
            var prole    = uService.ValidatePageRole(User.Identity.GetUserId(), Page_Code.P0016);

            if (prole == null)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }
            if (prole.View == null || prole.View == false)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }

            ModelState.Clear();
            model.Modify = prole.Modify;
            model.View   = prole.View;
            model.result = msgresult; // return result from http post
            var cmsService = new CMSService();
            var cbService  = new ComboService();
            var hasCri     = new ComboCriteria()
            {
                Date_Delivered = true, Delivery_Order_No = true
            };

            model.purgelist = new List <CMS_Purge>();

            if (!string.IsNullOrEmpty(model.Date_From) || !string.IsNullOrEmpty(model.Date_To) || !string.IsNullOrEmpty(model.Drum_Code))
            {
                var cri = new CMSCriteria();
                cri.Date_From            = model.Date_From;
                cri.Date_To              = model.Date_To;
                cri.Drum_Code            = model.Drum_Code;
                cri.Drum_Code_Have_Value = true;
                var result = cmsService.GetCMSPurge(cri);
                if (result.Code == ReturnCode.SUCCESS)
                {
                    model.purgelist = result.Object as List <CMS_Purge>;
                }

                cri = new CMSCriteria();
                cri.Drum_Code_Have_Value = true;
                var result2 = cmsService.GetCMSPurge(cri);
                if (result2.Code == ReturnCode.SUCCESS)
                {
                    model.purgelistAll = result2.Object as List <CMS_Purge>;
                }
            }
            return(View(model));
        }
コード例 #5
0
        public ActionResult GlobalLookup(GlobalLookupViewModel model, ServiceResult msgresult)
        {
            var uService = new UserService(User.Identity.GetUserId());
            var prole    = uService.ValidatePageRole(User.Identity.GetUserId(), Page_Code.P0014);

            if (prole == null)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }
            if (prole.View == null || prole.View == false)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }

            ModelState.Clear();
            if (model.operation == Operation.D)
            {
                return(GlobalLookup(model));
            }

            model.result = msgresult;
            model.Modify = prole.Modify;
            model.View   = prole.View;

            var cService = new ComboService();

            model.cGlobalDefList = cService.LstLookupDef();
            if (model.cGlobalDefList.Count > 0 && !model.search_Def_ID.HasValue)
            {
                model.search_Def_ID = NumUtil.ParseInteger(model.cGlobalDefList[0].Value);
            }

            if (model.search_Def_ID.HasValue)
            {
                var gService = new GlobalLookupService();
                var cri      = new GlobalLookupCriteria();
                cri.Def_ID = model.search_Def_ID;
                var result = gService.GetGlobalLookupData(cri);
                if (result.Code == ReturnCode.SUCCESS)
                {
                    model.GlobalDataList = result.Object as List <Global_Lookup_Data>;
                }
            }
            return(View(model));
        }
コード例 #6
0
        public void OnTextBufferChanged(IAdornmentLayer adornmentLayer, IWpfTextView view, int streakCount)
        {
            if (titleImage == null)
            {
                titleImage = new Image();
                titleImage.UpdateSource(GetTitleImage(IsDarkMode(view.Background)));
                adornmentLayer.RefreshImage(titleImage, view.ViewportRight - RightMargin - ADORNMENT_WIDTH, view.ViewportTop + TopMargin);
            }


            var comboNumberImageTuple = GetStreakCounterImage(streakCount);

            if (streakCounterImage == null)
            {
                streakCounterImage = new Image();
            }
            streakCounterImage.UpdateSource(comboNumberImageTuple.Item1);
            adornmentLayer.RefreshImage(streakCounterImage, view.ViewportRight - RightMargin - ADORNMENT_WIDTH, view.ViewportTop + TopMargin + ADORNMENT_TITLE_HEIGHT);

            ScaleTransform trans = new ScaleTransform();

            streakCounterImage.RenderTransformOrigin = new Point((ADORNMENT_WIDTH - comboNumberImageTuple.Item2.Width / 2) / ADORNMENT_WIDTH, (comboNumberImageTuple.Item2.Height / 2) / comboNumberImageTuple.Item2.Height);
            streakCounterImage.RenderTransform       = trans;

            trans.BeginAnimation(ScaleTransform.ScaleXProperty, GetStreakCounterImageSizeAnimation(streakCount));
            trans.BeginAnimation(ScaleTransform.ScaleYProperty, GetStreakCounterImageSizeAnimation(streakCount));


            if (ComboService.ShowExclamation(streakCount))
            {
                ShowExclamation(adornmentLayer, view, GetExclamationImage(streakCount), comboNumberImageTuple.Item2.Height);
            }

            var achievevments = AchievementsService.GetAchievements();

            if (streakCount > 0 && achievevments.MaxComboStreak < streakCount && !newMaxComboStreakReached)
            {
                ShowExclamation(adornmentLayer, view, GetNewMaxExclamationImage(streakCount), comboNumberImageTuple.Item2.Height);
                newMaxComboStreakReached = true;
            }

            if (streakCount == 0 && newMaxComboStreak > 0)
            {
                achievevments.MaxComboStreak = newMaxComboStreak;
                AchievementsService.SaveToStorage(achievevments);
                newMaxComboStreakReached = false;
            }
            newMaxComboStreak = streakCount;
        }
コード例 #7
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] //TODO: HTTP method (access level and verb)
            HttpRequest req,                                                         //TODO: not used
            ILogger log)
        {
            var orderId = Guid.NewGuid();

            log.LogWarning("Getting all possible combos for this order"); //TODO: wrong log level and no identifier specified

            var comboRepository = new ComboRepository();
            var comboService    = new ComboService();
            var combos          = comboService.GetMashedPotatoesCombo();

            return(new OkObjectResult($"Here are the possible orders for order Id {orderId}: {combos}")); //TODO: needs to be serialized into JSON and should only return object
        }
コード例 #8
0
        public void Unload()
        {
            foreach (var member in Context.Player.PlayerParty.Members)
            {
                member.OnSpawn        -= Member_OnSpawn;
                member.OnDamageChange -= Member_OnDamageChange;
            }
            Context.Player.OnPeaceZoneEnter -= Player_OnPeaceZoneEnter;
            Context.Player.OnPeaceZoneLeave -= Player_OnPeaceZoneLeave;
            this.Context = null;

            this.comboService.Stop();
            this.comboService = null;
            DestroyWidgets();
        }
コード例 #9
0
        public ActionResult RoleSetup(RoleSetupViewModel model, ServiceResult msgresult)
        {
            var uService = new UserService();
            var prole    = uService.ValidatePageRole(User.Identity.GetUserId(), Page_Code.P0000);

            if (prole == null)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }
            if (prole.View == null || prole.View == false)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }

            ModelState.Clear();
            if (model.operation == Operation.D)
            {
                return(RoleSetup(model));
            }

            model.result = msgresult;
            model.Modify = prole.Modify;
            model.View   = prole.View;

            var cbService = new ComboService();
            var rService  = new RoleService();

            model.cPageList = cbService.LstPage();
            model.cRoleList = cbService.LstRole(true);

            var rcri = new RoleCriteria();

            rcri.Role_ID = model.sRole_ID;
            var result = rService.GetPageRole(rcri);

            if (result.Code == ReturnCode.SUCCESS)
            {
                model.PageRoleList = result.Object as List <Page_Role>;
            }

            return(View(model));
        }
コード例 #10
0
        private DoubleAnimation GetStreakCounterImageSizeAnimation(int streakCount)
        {
            if (!ComboService.AnimationOnStreakCouunter(streakCount))
            {
                return(null);
            }

            return(new DoubleAnimation()
            {
                EasingFunction = new BackEase {
                    Amplitude = 2, EasingMode = EasingMode.EaseOut
                },
                From = 0.85,
                To = 1,
                Duration = TimeSpan.FromMilliseconds(100)
            });
        }
コード例 #11
0
        private void TextBuffer_Changed(object sender, TextContentChangedEventArgs e)
        {
            if (lastTextChangeTime.AddMilliseconds(TEXT_CHANGE_THROTTLED_MILLISECONDS) > DateTime.Now)
            {
                return;
            }
            lastTextChangeTime = DateTime.Now;
            //  TODO: Should have a better way to reduce effect of batch action, such as: CTRL+Z

            RefreshSettings();

            if (!generalSettings.IsEnablePowerMode)
            {
                return;
            }

            if (generalSettings.IsEnableComboMode)
            {
                KeyDown();

                if (comboModeSettings.IsShowStreakCounter)
                {
                    streakCounterAdornment.OnTextBufferChanged(adornmentLayer, view, streakCount);
                }
                if (ComboService.CanScreenShake(streakCount) && generalSettings.IsEnableScreenShake)
                {
                    screenShakeAdornment.OnTextBufferChanged(adornmentLayer, view, streakCount);
                }
                if (ComboService.CanShowParticles(streakCount) && generalSettings.IsEnableParticles)
                {
                    particlesAdornment.OnTextBufferChanged(adornmentLayer, view, streakCount);
                }
            }
            else
            {
                if (generalSettings.IsEnableParticles)
                {
                    particlesAdornment.OnTextBufferChanged(adornmentLayer, view, streakCount);
                }
                if (generalSettings.IsEnableScreenShake)
                {
                    screenShakeAdornment.OnTextBufferChanged(adornmentLayer, view, streakCount);
                }
            }
        }
コード例 #12
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest request,
            ILogger log)
        {
            var orderId = Guid.NewGuid();

            log.LogInformation("Placing new order.");


            if (!request.IsJson())
            {
                return(new UnsupportedMediaTypeResult());
            }

            var kidsMeal     = new KidMealCombo(new FrenchFry(), new IceCream());
            var comboService = new ComboService();
            var newOrder     = comboService.PlaceOrderAsync(kidsMeal);

            return(new AcceptedResult()); //TODO: Should return 201 Created result
        }
コード例 #13
0
        public void Initialize(Game context)
        {
            this.Context = context;

            CreateWidgets();
            this.initialDamageIsSet = false;
            this.comboService       = new ComboService(new ThresholdStrategy(context), notificationsWidget, comboMeterWidget, ConfigService.Current.ComboTimeout);

            foreach (var member in Context.Player.PlayerParty.Members)
            {
                member.OnSpawn        += Member_OnSpawn;
                member.OnDamageChange += Member_OnDamageChange;
            }

            // if HunterPie launched when game is running, we need to set initial damage after player is scanned
            if (!this.Context.Player.InPeaceZone)
            {
                WaitForPlayerScan().ContinueWith(_ => SetInitialDamage());
            }

            context.Player.OnPeaceZoneEnter += Player_OnPeaceZoneEnter;
            context.Player.OnPeaceZoneLeave += Player_OnPeaceZoneLeave;
        }
コード例 #14
0
        private Bitmap GetNewMaxExclamationImage(int streakCount)
        {
            var font  = new Font("Tahoma", ComboService.GetPowerLevelExclamationFontSize(streakCount));
            var color = ComboService.GetPowerLevelColor(streakCount);

            var bitmap = new Bitmap(ADORNMENT_WIDTH, ADORNMENT_EXCLAMATION_HEIGHT);

            bitmap.MakeTransparent();

            using (var graphics = Graphics.FromImage(bitmap))
            {
                graphics.SmoothingMode     = SmoothingMode.AntiAlias;
                graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                graphics.PixelOffsetMode   = PixelOffsetMode.HighQuality;

                var exclamation = "New MAX !!!";
                var size        = graphics.MeasureString(exclamation, font);
                graphics.DrawString(exclamation, font, new SolidBrush(color), new RectangleF(ADORNMENT_WIDTH - size.Width, 0, size.Width, ADORNMENT_EXCLAMATION_HEIGHT));

                graphics.Flush();
                return(bitmap);
            }
        }
コード例 #15
0
        public ActionResult Users(UserViewModel model, ServiceResult msgresult)
        {
            var uService = new UserService(User.Identity.GetUserId());
            var prole    = uService.ValidatePageRole(User.Identity.GetUserId(), Page_Code.P0010);

            if (prole == null)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }
            if (prole.View == null || prole.View == false)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }

            ModelState.Clear();
            if (model.operation == Operation.D)
            {
                var dcri = new UserCriteria();
                dcri.Profile_ID = model.Profile_ID;
                var result = uService.GetUser(dcri);
                if (result.Code == ReturnCode.SUCCESS)
                {
                    var users = result.Object as List <User_Profile>;
                    if (users != null && users.Count() == 1)
                    {
                        var user = new User_Profile();
                        user = users.FirstOrDefault();
                        user.Record_Status = Record_Status.Delete;
                        model.result       = uService.UpdateUser(user);
                        if (model.result.Code == ReturnCode.SUCCESS)
                        {
                            msgresult = new ServiceResult()
                            {
                                Code = ReturnCode.SUCCESS, Msg = Success.GetMessage(ReturnCode.SUCCESS_DELETE), Field = Resource.User
                            }
                        }
                        ;
                        else
                        {
                            msgresult = new ServiceResult()
                            {
                                Code = ReturnCode.ERROR_DELETE, Msg = Error.GetMessage(ReturnCode.ERROR_DELETE), Field = Resource.User
                            }
                        };
                    }
                }
            }

            model.result = msgresult; // return result from http post
            model.Modify = prole.Modify;
            model.View   = prole.View;

            var cri     = new UserCriteria();
            var uresult = uService.GetUser(cri);

            if (uresult.Code == ReturnCode.SUCCESS)
            {
                model.Userlist = uresult.Object as List <User_Profile>;
            }

            var cbService = new ComboService();

            model.cRole = cbService.LstRole();

            return(View(model));
        }
コード例 #16
0
        public async Task <ActionResult> Users(UserViewModel model)
        {
            var uService = new UserService(GetUser());

            if (model.operation != Operation.C)
            {
                List <string> formatTemp = new List <string>();
                formatTemp.AddRange(new string[] { "Password", "Confirm_Password" });

                foreach (var key in ModelState.Keys.ToList().Where(key => ModelState.ContainsKey(key) && (formatTemp.Contains(key))))
                {
                    ModelState[key].Errors.Clear();
                }
            }
            var errs = GetErrorModelState();

            var guser = uService.getUserByEmail(model.Email_Address);

            if (guser != null)
            {
                if (model.operation == Operation.C)
                {
                    ModelState.AddModelError("Email_Address", Resource.The + " " + Resource.Email + " " + Resource.Is_Rrequired);
                }
                else if (model.operation == Operation.U && model.Profile_ID != guser.Profile_ID)
                {
                    ModelState.AddModelError("Email_Address", Resource.The + " " + Resource.Email + " " + Resource.Is_Rrequired);
                }
            }

            if (ModelState.IsValid)
            {
                var user = new User_Profile();
                if (model.operation == Operation.U)
                {
                    var cri = new UserCriteria();
                    cri.Profile_ID = model.Profile_ID;
                    var result = uService.GetUser(cri);
                    if (result.Code == ReturnCode.SUCCESS)
                    {
                        var users = result.Object as List <User_Profile>;
                        if (users != null && users.Count() == 1)
                        {
                            user = users.FirstOrDefault();
                        }
                    }
                }

                user.Email_Address      = model.Email_Address;
                user.Name               = model.Name;
                user.LDAP_Username      = model.LDAP_Username;
                user.Role_ID            = model.Role_ID;
                user.Email_Notification = model.Email_Notification;

                if (model.operation == Operation.C)
                {
                    user.Activated = true;
                    var uService2 = new UserService(user);
                    user.PWD     = model.Password;
                    model.result = uService2.InsertUser(user);
                    if (model.result.Code == ReturnCode.SUCCESS)
                    {
                        UserManager <ApplicationUser> userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new AgnosDBContext()));
                        userManager.UserValidator = new UserValidator <ApplicationUser>(userManager)
                        {
                            AllowOnlyAlphanumericUserNames = false
                        };
                        IdentityResult iresult = await userManager.RemovePasswordAsync(user.ApplicationUser_Id);

                        if (iresult.Succeeded)
                        {
                            iresult = await userManager.AddPasswordAsync(user.ApplicationUser_Id, model.Password);

                            if (iresult.Succeeded)
                            {
                            }
                        }
                    }
                }
                else if (model.operation == Operation.U)
                {
                    model.result = uService.UpdateUser(user);
                }

                if (model.result.Code == ReturnCode.SUCCESS)
                {
                    return(RedirectToAction("Users", new AppRouteValueDictionary(model)));
                }
            }

            var cri2    = new UserCriteria();
            var uresult = uService.GetUser(cri2);

            if (uresult.Code == ReturnCode.SUCCESS)
            {
                model.Userlist = uresult.Object as List <User_Profile>;
            }

            var cbService = new ComboService();

            model.cRole = cbService.LstRole();

            var prole = uService.ValidatePageRole(User.Identity.GetUserId(), Page_Code.P0010);

            if (prole != null)
            {
                model.Modify = prole.Modify;
            }

            return(View(model));
        }
コード例 #17
0
 public FriesController(FryService service, ComboService cs)
 {
     _service      = service;
     _comboService = cs;
 }
コード例 #18
0
 public CombosController(ComboService cs)
 {
     _comboService = cs;
 }
コード例 #19
0
 public SidesController(SideService service, ComboService cs)
 {
     _service      = service;
     _comboService = cs;
 }
コード例 #20
0
        public ActionResult GlobalLookup(GlobalLookupViewModel model)
        {
            var gService = new GlobalLookupService();

            if (ModelState.IsValid)
            {
                var gdata = new Global_Lookup_Data();
                if (model.operation == Operation.U || model.operation == Operation.D)
                {
                    var cri = new GlobalLookupCriteria();
                    cri.Lookup_Data_ID = model.Lookup_Data_ID;
                    var result = gService.GetGlobalLookupData(cri);
                    if (result.Code == ReturnCode.SUCCESS)
                    {
                        var gdatas = result.Object as List <Global_Lookup_Data>;
                        if (gdatas != null && gdatas.Count() == 1)
                        {
                            gdata = gdatas.FirstOrDefault();
                        }
                    }
                }

                if (model.operation != Operation.D)
                {
                    gdata.Def_ID    = model.Def_ID.Value;
                    gdata.Data_Code = model.Data_Code;
                    gdata.Name      = model.Name;
                }

                if (model.operation == Operation.C)
                {
                    gdata.Record_Status = Record_Status.Active;
                    model.result        = gService.InsertGlobalLookupData(gdata);
                }
                else if (model.operation == Operation.U)
                {
                    model.result = gService.UpdateGlobalLookupData(gdata);
                }
                else if (model.operation == Operation.D)
                {
                    gdata.Record_Status = Record_Status.Delete;
                    model.result        = gService.UpdateGlobalLookupData(gdata);
                    if (model.result.Code == ReturnCode.SUCCESS)
                    {
                        model.result = new ServiceResult()
                        {
                            Code = ReturnCode.SUCCESS, Msg = Success.GetMessage(ReturnCode.SUCCESS_DELETE), Field = Resource.Global_Lookup
                        }
                    }
                    ;
                    else
                    {
                        model.result = new ServiceResult()
                        {
                            Code = ReturnCode.ERROR_DELETE, Msg = Error.GetMessage(ReturnCode.ERROR_DELETE), Field = Resource.Global_Lookup
                        }
                    };

                    var route = new RouteValueDictionary(model.result);
                    route.Add("search_Def_ID", gdata.Def_ID);
                    return(RedirectToAction("GlobalLookup", route));
                }

                if (model.result.Code == ReturnCode.SUCCESS)
                {
                    var route = new RouteValueDictionary(model.result);
                    route.Add("search_Def_ID", model.Def_ID);
                    return(RedirectToAction("GlobalLookup", route));
                }
            }

            var cService = new ComboService();

            model.cGlobalDefList = cService.LstLookupDef();
            if (model.cGlobalDefList.Count > 0 && !model.search_Def_ID.HasValue)
            {
                model.search_Def_ID = NumUtil.ParseInteger(model.cGlobalDefList[0].Value);
            }

            if (model.search_Def_ID.HasValue)
            {
                var cri    = new GlobalLookupCriteria();
                var result = gService.GetGlobalLookupData(cri);
                if (result.Code == ReturnCode.SUCCESS)
                {
                    model.GlobalDataList = result.Object as List <Global_Lookup_Data>;
                }
            }
            return(View(model));
        }
    }
コード例 #21
0
        public ActionResult RoleSetup(RoleSetupViewModel model)
        {
            var rService = new RoleService();

            if (model.tabAction == "pagerole")
            {
                if (model.Role_ID.HasValue && model.Page_ID.HasValue)
                {
                    var cri = new RoleCriteria();
                    cri.Role_ID = model.Role_ID;
                    cri.Page_ID = model.Page_ID;
                    var result = rService.GetPageRole(cri);
                    if (result.Code == ReturnCode.SUCCESS)
                    {
                        var dup  = new Page_Role();
                        var dups = result.Object as List <Page_Role>;
                        if (dups != null && dups.Count() != 0)
                        {
                            if (model.operation == Operation.C)
                            {
                                ModelState.AddModelError("Page_ID", Resource.The + " " + Resource.Page + " " + Resource.Field + " " + Resource.Is_Duplicated);
                            }
                            else if (model.operation == Operation.U)
                            {
                                dup = dups.FirstOrDefault();
                                if (dup.Page_Role_ID != model.Page_Role_ID)
                                {
                                    ModelState.AddModelError("Page_ID", Resource.The + " " + Resource.Page + " " + Resource.Field + " " + Resource.Is_Duplicated);
                                }
                            }
                        }
                    }
                }

                if (ModelState.IsValid)
                {
                    var prole = new Page_Role();
                    if (model.operation == Operation.U || model.operation == Operation.D)
                    {
                        var cri = new RoleCriteria();
                        cri.Page_Role_ID = model.Page_Role_ID;
                        var result = rService.GetPageRole(cri);
                        if (result.Code == ReturnCode.SUCCESS)
                        {
                            var proles = result.Object as List <Page_Role>;
                            if (proles != null && proles.Count() == 1)
                            {
                                prole = proles.FirstOrDefault();
                            }
                        }
                    }

                    if (model.operation != Operation.D)
                    {
                        prole.Role_ID = model.Role_ID;
                        prole.Page_ID = model.Page_ID;
                        prole.Modify  = (model.Modify.HasValue && model.Modify.Value ? true : false);
                        prole.View    = (model.View.HasValue && model.View.Value ? true : false);
                        prole.Close   = (model.Close.HasValue && model.Close.Value ? true : false);

                        if (prole.Modify.HasValue && prole.Modify.Value)
                        {
                            prole.View = true;
                        }

                        if (prole.Page_ID == 9 && prole.Role_ID == 5)
                        {
                            prole.View   = true;
                            prole.Modify = true;
                        }
                    }

                    if (model.operation == Operation.C)
                    {
                        model.result = rService.InsertPageRole(prole);
                    }

                    else if (model.operation == Operation.U)
                    {
                        model.result = rService.UpdatePageRole(prole);
                    }

                    else if (model.operation == Operation.D)
                    {
                        prole.Record_Status = Record_Status.Delete;
                        model.result        = rService.UpdatePageRole(prole);
                        if (model.result.Code == ReturnCode.SUCCESS)
                        {
                            model.result = new ServiceResult()
                            {
                                Code = ReturnCode.SUCCESS, Msg = Success.GetMessage(ReturnCode.SUCCESS_DELETE), Field = Resource.Page_Role
                            }
                        }
                        ;
                        else
                        {
                            model.result = new ServiceResult()
                            {
                                Code = ReturnCode.ERROR_DELETE, Msg = Error.GetMessage(ReturnCode.ERROR_DELETE), Field = Resource.Page_Role
                            }
                        };

                        return(RedirectToAction("RoleSetup", new AppRouteValueDictionary(model)));
                    }

                    if (model.result.Code == ReturnCode.SUCCESS)
                    {
                        return(RedirectToAction("RoleSetup", new AppRouteValueDictionary(model)));
                    }
                }
            }

            var cbService = new ComboService();

            model.cPageList = cbService.LstPage();
            model.cRoleList = cbService.LstRole(true);

            var rcri = new RoleCriteria();

            rcri.Role_ID = model.Role_ID;
            var result2 = rService.GetPageRole(rcri);

            if (result2.Code == ReturnCode.SUCCESS)
            {
                model.PageRoleList = result2.Object as List <Page_Role>;
            }
            return(View(model));
        }
    }
コード例 #22
0
 public BurgersController(BurgerService service, ComboService cs)
 {
     _service      = service;
     _comboService = cs;
 }
コード例 #23
0
 public ComboController(ComboService service, ComboService cs)
 {
     _service      = service;
     _comboService = cs;
 }
コード例 #24
0
 public MainPageController()
 {
     _comboService = new ComboService();
     _menuService  = new MenuService();
 }
コード例 #25
0
        public ActionResult InventoryReport(CMSReportViewModels model, ServiceResult msgresult)
        {
            var uService = new UserService();
            var prole    = uService.ValidatePageRole(User.Identity.GetUserId(), Page_Code.P0016);

            if (prole == null)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }
            if (prole.View == null || prole.View == false)
            {
                return(RedirectToAction("ErrorPage", "Account", new ErrorViewModel()
                {
                    Message = Resource.Message_Access_Denied
                }));
            }

            ModelState.Clear();
            model.Modify = prole.Modify;
            model.View   = prole.View;
            model.result = msgresult; // return result from http post
            var cmsService = new CMSService();
            var cbService  = new ComboService();
            var hasCri     = new ComboCriteria()
            {
                Date_Charged = true
            };

            model.cSortlist = cbService.LstSortAction(false, hasCri);

            model.cProductCodelist = cbService.LstProductByCode(true);


            model.chargelist = new List <CMS_Charge>();

            if (!string.IsNullOrEmpty(model.Lot_No) || !string.IsNullOrEmpty(model.Drum_Code) || !string.IsNullOrEmpty(model.Product_Code))
            {
                var cri = new CMSCriteria();
                cri.Lot_No               = model.Lot_No;
                cri.Drum_Code            = model.Drum_Code;
                cri.Product_Code         = model.Product_Code;
                cri.Not_Yet_Deliver      = true;
                cri.Sort_By              = model.Sort_By;
                cri.Drum_Code_Have_Value = true;
                var result = cmsService.GetCMSCharge(cri);
                if (result.Code == ReturnCode.SUCCESS)
                {
                    model.chargelist = result.Object as List <CMS_Charge>;
                }

                cri = new CMSCriteria();
                cri.Drum_Code_Have_Value = true;
                var result2 = cmsService.GetCMSCharge(cri);
                if (result2.Code == ReturnCode.SUCCESS)
                {
                    model.chargelistAll = result2.Object as List <CMS_Charge>;
                }
            }
            return(View(model));
        }