public IActionResult UploadWorkDetail(string ParameterText, string ParameterValue, IFormFile file)
        {
            ParameterService parameterService = new ParameterService(_context);
            FileService      FileService      = new FileService(_hostingEnvironment, _context);
            string           ErrorMsg         = string.Empty;
            string           userId           = _userManager.GetUserId(HttpContext.User);
            string           userName         = HttpContext.User.Identity.Name;

            PDC_File      newFile = new PDC_File();
            PDC_Parameter item    = parameterService.GetParameterOne("ConfigurationWorkDetail");

            if (file.Length > 0)
            {
                PDC_File WorkDetail_File = FileService.GetFileList("ConfigurationWorkDetail", item.ParameterID).FirstOrDefault();

                if (WorkDetail_File != null)
                {
                    FileService.FileRemove(WorkDetail_File.FileID);
                }

                FileService.FileAdd(file, "ConfigurationWorkDetail", userId, userName, out newFile, item.ParameterID);
            }

            item.ParameterText  = ParameterText;
            item.ParameterValue = ParameterValue;
            item.Modifyer       = userId;
            item.ModifyerName   = userName;
            item.ModifyerDate   = DateTime.Now;

            parameterService.UpdateParameter(item, ref ErrorMsg);

            return(Json(new { ErrorMsg = ErrorMsg, File = newFile }));
        }
Пример #2
0
        public void GetParamValue_ReturnsEnum_WhenPassedValidEnum()
        {
            var service = new ParameterService();
            var val     = service.GetParamValue("EnumOne", typeof(SampleEnum));

            Assert.AreEqual(SampleEnum.EnumOne, val);
        }
Пример #3
0
        public void IsEnumerable_ReturnsFalse_WhenPassedNonEnumerableType(Type type)
        {
            var service = new ParameterService();
            var actual  = service.IsEnumerable(type);

            Assert.AreEqual(false, actual);
        }
Пример #4
0
        public void GetParamValue_ReturnsUnderlyingValue_WhenPassedValidNullable(string value, dynamic expected, Type type)
        {
            var service = new ParameterService();
            var val     = service.GetParamValue(value, type);

            Assert.AreEqual(expected, val);
        }
        public IActionResult ParameterChangeOrderNo(Int64 ParameterID1, Int64 ParameterID2, int OrderNo1, int OrderNo2)
        {
            ExcelHepler Helper   = new ExcelHepler(_hostingEnvironment);
            string      userId   = _userManager.GetUserId(HttpContext.User);
            string      userName = HttpContext.User.Identity.Name;

            ParameterService parameterService = new ParameterService(_context);
            FileService      FileService      = new FileService(_hostingEnvironment, _context);

            PDC_Parameter item1 = parameterService.GetParameterOne(ParameterID1);
            PDC_Parameter item2 = parameterService.GetParameterOne(ParameterID2);

            string ErrorMsg = string.Empty;

            item1.OrderNo      = OrderNo1;
            item1.Modifyer     = userId;
            item1.ModifyerName = userName;
            item1.ModifyerDate = DateTime.Now;
            parameterService.UpdateParameter(item1, ref ErrorMsg);


            item2.OrderNo      = OrderNo2;
            item2.Modifyer     = userId;
            item2.ModifyerName = userName;
            item2.ModifyerDate = DateTime.Now;
            parameterService.UpdateParameter(item2, ref ErrorMsg);



            return(Json(ErrorMsg));
        }
Пример #6
0
        public ActionResult UpDataParameter(string parameterId, string uplimit, string lowlimit)
        {
            string json = null;

            json = new ParameterService().UpDataParameter(parameterId, uplimit, lowlimit);
            return(Content(json));
        }
Пример #7
0
 public void fillDrawInfoLabels(DateTime pDrawDate, long pGroupId)
 {
     
     this.clearDrawInfoLabels();
     if (pGroupId != 0)
     {
         DrawTypeService drawTypeService = new DrawTypeService();
         LDT_LotteryDrawType drawType = drawTypeService.getById(pGroupId);
         if (drawType != null)
         {
             this.setPosNameLabel(ParameterService.getSystemSalePoint().LPS_DisplayName);
             this.setDrawTitleLabel("Sorteo:");
             this.setGroupNameLabel(drawType.LDT_DisplayName);
             this.setDayDrawLabel(UtilityService.getDayName(pDrawDate));
             this.setDateDrawLabel(UtilityService.getSimpleDate(pDrawDate));
         }
         PrizeFactorService prizeFactorService = new PrizeFactorService();
         LPF_LotteryPrizeFactor prizeFactor = prizeFactorService.getByPointSaleAndGroup(ParameterService.getSalePointId(), pGroupId);
         if (prizeFactor != null)
         {
             string prizes = Convert.ToInt32(prizeFactor.LPF_FirtsPrizeFactor) + "% | "
                 + Convert.ToInt32(prizeFactor.LPF_SecondPrizeFactor) + "% | "
                 + Convert.ToInt32(prizeFactor.LPF_ThirdPrizeFactor) + "%"
                 ;
             this.setPayDrawTitleLabel("Paga:");
             this.setPrizeFactorDrawLabel(prizes);
         }
     }
     
 }
Пример #8
0
        public ResponseResult UpDataParameter(string parameterId, string uplimit, string lowlimit)
        {
            var              result           = ResponseResult.Default();
            bool             status           = false;
            ParameterService parameterservice = new ParameterService();

            try
            {
                if (string.IsNullOrEmpty(parameterId))
                {
                    return(ResponseResult.Error("参数Id不能为空"));
                }
                if (string.IsNullOrEmpty(uplimit))
                {
                    return(ResponseResult.Error("上限不能为空"));
                }
                if (string.IsNullOrEmpty(lowlimit))
                {
                    return(ResponseResult.Error("下限不能为空"));
                }

                else
                {
                    status = parameterservice.UpDataParameter(Convert.ToInt32(parameterId), uplimit, lowlimit);
                    result = ResponseResult.Success("修改成功");
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult.Error(ex.Message);
            }
            return(result);
        }
Пример #9
0
        public ResponseResult <Parameter> GetParameter(string loginName)
        {
            var result = ResponseResult <Parameter> .Default();

            ParameterService parameterservice = new ParameterService();
            List <Parameter> parameters       = new List <Parameter>();

            try
            {
                if (string.IsNullOrEmpty(loginName))
                {
                    return(ResponseResult <Parameter> .Error("登录名称不能为空"));
                }
                else
                {
                    parameters = parameterservice.GetParameter(loginName);
                    result     = ResponseResult <Parameter> .Success(parameters, "获取成功");
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <Parameter> .Error(ex.Message);
            }
            return(result);
        }
Пример #10
0
        protected virtual TeamCityConfigurationParameter GetParameter(MemberInfo member, NukeBuild build, bool required)
        {
            var attribute = member.GetCustomAttribute <ParameterAttribute>();
            var valueSet  = ParameterService.GetParameterValueSet(member, build);

            var defaultValue = member.GetValue(build);

            if (member.GetMemberType() == typeof(AbsolutePath) ||
                member.GetMemberType() == typeof(Solution) ||
                member.GetMemberType() == typeof(Project))
            {
                defaultValue = (UnixRelativePath)GetRelativePath(NukeBuild.RootDirectory, defaultValue.ToString());
            }

            return(new TeamCityConfigurationParameter
            {
                Name = member.Name,
                Description = attribute.Description,
                Options = valueSet?.ToDictionary(x => x.Item1, x => x.Item2),
                Type = valueSet != null ? TeamCityParameterType.Select : TeamCityParameterType.Text,
                DefaultValue = defaultValue?.ToString(),
                Display = required ? TeamCityParameterDisplay.Prompt : TeamCityParameterDisplay.Normal,
                AllowMultiple = member.GetMemberType().IsArray,
                ValueSeparator = attribute.Separator ?? " "
            });
        }
Пример #11
0
        protected virtual List <RouteSegment> BuildRoute(string routeUrl)
        {
            if (!CaseSensitive)
            {
                routeUrl = routeUrl.ToLowerInvariant();
            }

            List <RouteSegment> result = new List <RouteSegment>();

            int lastIndex = 0;

            TokenParser.OnParsedToken += (sender, e) =>
            {
                if (e.StartPosition > lastIndex)
                {
                    result.Add(new StaticRouteSegment(routeUrl.Substring(lastIndex, e.StartPosition - lastIndex)));
                }

                result.Add(new ParamRouteSegment(ParameterService.Get(e.Token.Fullname)));
                lastIndex = e.EndPosition + 1;
            };

            if (!TokenParser.Parse(routeUrl))
            {
                throw Ensure.Exception.ArgumentOutOfRange("routeUrl", "Route url is not valid format for TokenRoute.");
            }

            if (routeUrl.Length > lastIndex)
            {
                result.Add(new StaticRouteSegment(routeUrl.Substring(lastIndex)));
            }

            return(result);
        }
Пример #12
0
        public ActionResult ModelParametersEdit(string id)
        {
            var model = ParameterService.GetParameter(new Guid(id));

            model.Units = ParameterService.GetUnitsList();
            return(View(model));
        }
Пример #13
0
        public ActionResult GetParameter()
        {
            string json      = null;
            string LoginName = Session["LoginName"].ToString();

            json = new ParameterService().GetParameter(LoginName);
            return(Content(json));
        }
Пример #14
0
        public IActionResult PCBChangeItem(Int64 ParameterID)
        {
            ParameterService parameterService = new ParameterService(_context);


            List <SelectListItem> PCBItemList = parameterService.GetSelectList(ParameterID);

            return(Json(PCBItemList));
        }
Пример #15
0
        private void savePrinterButton_Click(object sender, EventArgs e)
        {
            string printerName = this.printerBox.SelectedValue.ToString();

            ParameterService.setPrinter(printerName);
            ParameterService.setEnablePrinter(cbxEnablePrint.Checked ? "1" : "0");
            this.closeView();
            MessageService.displayInfoMessage(GeneralConstants.SET_PRINTER_MESSAGE + printerName, GeneralConstants.SET_PRINTER_TITLE);
        }
Пример #16
0
        private void showSalePointName()
        {
            LPS_LotteryPointSale posInstance = ParameterService.getSystemSalePoint();

            if (posInstance != null)
            {
                this.posNameLabel.Text = "SUCURSAL " + posInstance.LPS_DisplayName;
            }
        }
Пример #17
0
        public ParameterServiceTest()
        {
            _serviceProvider = new ServiceCollection()
                               .AddTransient(sp => _mockParameterRepo.Object)
                               .AddTransient <ParameterService>()
                               .BuildServiceProvider();

            _sut = _serviceProvider.GetService <ParameterService>();
        }
Пример #18
0
        public IActionResult SearchPCBParameter(Int64 ParameterID)
        {
            ParameterService parameterService = new ParameterService(_context);

            List <PDC_Parameter> model = new List <PDC_Parameter>();

            model = parameterService.GetParameterList(ParameterID);

            return(Json(model));
        }
Пример #19
0
        public void saveSyncParams()
        {
            string newTimeInterval = this.txtSyncPeriod.Text;

            ParameterService.setPeriodSyncInterval(newTimeInterval);
            ParameterService.setPeriodSyncEnabled(cbxEnableSync.Checked);
            this.appMediator.restartPeriodSync();
            this.closeView();
            MessageService.displayInfoMessage(GeneralConstants.SET_PERIOD_SYNC_MESSAGE + newTimeInterval, GeneralConstants.SET_PERIOD_SYNC_TITLE);
        }
Пример #20
0
        public void GetAliasString_ReturnsEmptyString_WhenPassedNoAlias()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[0];

            var actual = service.GetAliasString(pi);

            Assert.AreEqual("", actual);
        }
Пример #21
0
        public IActionResult SearchPCB(Int64 ParameterID)
        {
            m_ConfigurationPartial model            = new m_ConfigurationPartial();
            ParameterService       parameterService = new ParameterService(_context);


            model.m_PCBParameter = parameterService.GetParameterOne(ParameterID);
            model.PCBFileList    = _context.PDC_File.Where(x => x.SourceID == ParameterID && x.FunctionName == "Configuration_PCBFile").ToList();

            return(Json(model));
        }
Пример #22
0
        public void GetDescriptionString_ReturnsEmptyString_WhenPassedParameterWithoutAttribute()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[2];

            var actual = service.GetDescriptionString(pi);

            Assert.AreEqual("", actual);
        }
Пример #23
0
        public void GetPriorityString_ReturnsRequired_WhenParameterHasNoDefault()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[1];

            var actual   = service.GetPriorityString(pi);
            var expected = "Required";

            Assert.AreEqual(expected, actual);
        }
Пример #24
0
        public void GetPriorityString_ReturnsOptional_WhenParameterHasDefaultValue()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[2];

            var actual   = service.GetPriorityString(pi);
            var expected = "Optional";

            Assert.AreEqual(expected, actual);
        }
Пример #25
0
        public void GetDocString_ReturnsStringWithCollectionOptions_WhenPassedEnumCollection()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[5];

            var actual   = service.GetDocString(pi, "Required", "type", " | --e");
            var expected = "--enumbs | --e (type): This parameter is Required and must be a collection of one of the following (EnumOne, EnumTwo, EnumThree)";

            Assert.AreEqual(expected, actual);
        }
Пример #26
0
        public void GetDocString_ReturnsString_WhenPassedNonEnum()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[0];

            var actual   = service.GetDocString(pi, "Required", "type", " | --f");
            var expected = "--foo | --f (type): This parameter is Required";

            Assert.AreEqual(expected, actual);
        }
Пример #27
0
        public void GetDescriptionString_ReturnsString_WhenPassedDescription()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[0];

            var actual   = service.GetDescriptionString(pi);
            var expected = $"Description: sets foo";

            Assert.AreEqual(expected, actual);
        }
Пример #28
0
        public void GetTypeString_ReturnsListOf_WhenParameterIsCollection()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[3];

            var actual   = service.GetTypeString(pi);
            var expected = "List of Int32";

            Assert.AreEqual(expected, actual);
        }
Пример #29
0
        public void GetTypeString_ReturnsNameOfUnderType_WhenParameterIsNotCollectionAndNullable()
        {
            var service = new ParameterService();
            var pi      = typeof(ParameterServiceTests)
                          .GetMethod("FakeMethod")
                          .GetParameters()[1];

            var actual   = service.GetTypeString(pi);
            var expected = "Int32";

            Assert.AreEqual(expected, actual);
        }
Пример #30
0
        public PartialViewResult SiteTitle()
        {
            var model = new HomeModel();

            try
            {
                model.SiteTitle = ParameterService.Get("SiteHeader").Value;
            }
            catch (Exception e)
            {
                Logger.Error("Hata oluştu - " + new StackTrace().GetFrame(0).GetMethod().Name, e);
            }
            return(PartialView(model));
        }
Пример #31
0
 public BaseController()
 {
     this.parameterService = new ParameterService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.Parameter = this.parameterService.GetAll();
 }