private async Task <List <String> > GetContractNames(PublicService ps) { using (var client = new HttpClient()) { var lst = new List <String>(); try { client.BaseAddress = new Uri(ConfigHelper.GetServiceUrl("proxy")); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = await client.GetAsync($"api/contract/ads?isName={ps.Name}"); if (response.IsSuccessStatusCode) { lst = await response.Content.ReadAsAsync <List <String> >(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(lst); } }
public ServiceBasedController() { if (service == null) { this.service = new PublicService(); } log = LogManager.GetLogger(this.GetType().FullName); _LicenseInfo = this.service._LicenseInfo;//zjy //ViewBag.LinceseInfo = string.Format("{0}({1}{2})", _LicenseInfo.LicenceTo, _LicenseInfo.Edition, _LicenseInfo.DaysLeftInTrial > 30 ? "" : "-" + _LicenseInfo.DaysLeftInTrial); //if(_LicenseInfo.Verify&&_LicenseInfo.type==1) // ViewBag.LinceseInfo = string.Format("{0}({1}{2})", "永久授权", "版本号:", _LicenseInfo.Version); try { if (_LicenseInfo.Verify && _LicenseInfo.type == 2) { DateTime dateEnd = Convert.ToDateTime(_LicenseInfo.DateEnd); if (dateEnd.AddDays(-7) < DateTime.Now) { ViewBag.LinceseInfo = string.Format("{0}({1}{2})", "限时授权 " + Convert.ToDateTime(_LicenseInfo.DateEnd).ToString("yyyy年MM月dd日") + "到期", " 版本号:", _LicenseInfo.Version); } } } catch (Exception e) { ViewBag.LinceseInfo = e.Message; } }
protected void BindRepeater() { PublicService ps = new PublicService(); IList <ZLERP.Model.LinkManRecord> list = ps.GetGenericService <ZLERP.Model.LinkManRecord>().Find(string.Format("Builder = '{0}'", AuthorizationService.CurrentUserInfo.ID), 1, 5, "BuildTime", "desc"); Repeater1.DataSource = list; Repeater1.DataBind(); }
void BindTodayProduceTasks() { SqlServerHelper helper = new SqlServerHelper(); DataSet ds = helper.ExecuteDataset("sp_kanban_producetasks", System.Data.CommandType.StoredProcedure, null); rptTasks.DataSource = ds; rptTasks.DataBind(); if (ds != null && ds.Tables.Count > 0) { lblTotalTaskCount.Text = string.Format("{0}", ds.Tables[0].Rows.Count); decimal ParCubes = 0; decimal PlanCubes = 0; int RunningCar = 0; int DDCar = 0; int dPlanTaskCount = 0; int dUnOpenCount = 0; int dCompletedCount = 0; DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { ParCubes += Convert.ToDecimal(dr["ParCubes"]); } if (dt.Rows.Count > 0) { PlanCubes = Convert.ToDecimal(dt.Rows[0]["PlanCubes"]); RunningCar = Convert.ToInt32(dt.Rows[0]["RunningCar"]); DDCar = Convert.ToInt32(dt.Rows[0]["DDCar"]); dPlanTaskCount = Convert.ToInt32(dt.Rows[0]["PlanTaskCount"]); dUnOpenCount = Convert.ToInt32(dt.Rows[0]["UnOpenCount"]); dCompletedCount = Convert.ToInt32(dt.Rows[0]["CompletedCount"]); } if (dPlanTaskCount > 0) { //显示计划任务数 this.lblTotalTaskCount.Text = dPlanTaskCount.ToString(); } this.lbUnOpenCount.Text = dUnOpenCount.ToString(); this.lbCompletedCount.Text = dCompletedCount.ToString(); this.lbTodayParCube.Text = ParCubes.ToString(); this.lbTodayPlanCube.Text = PlanCubes.ToString(); this.lbRunningCar.Text = RunningCar.ToString(); this.lbDDCar.Text = DDCar.ToString(); //今日计划方量采用系统配置中手动设置的方量 //modified by:Sky PublicService ps = new PublicService(); var planCube = ps.SysConfig.GetAllSysConfigs().Where(p => p.ConfigName == "TodayPlanAmount").FirstOrDefault(); decimal dSetPlanCube; //系统设置中方量设置不为0的数字时显示系统设置中的方量 //给有的站不使用工地计划备用 if (planCube != null && Decimal.TryParse(planCube.ConfigValue, out dSetPlanCube) && dSetPlanCube > 0) { this.lbTodayPlanCube.Text = dSetPlanCube.ToString(); } } }
/// <summary> /// 重写OnAuthorization /// </summary> /// <param name="filterContext"></param> public override void OnAuthorization(AuthorizationContext filterContext) { //移动版不验证 if (filterContext.RouteData.DataTokens["area"] != null && filterContext.RouteData.DataTokens["area"].ToString().ToLower() == "mobile") { return; } string controller = filterContext.RouteData.Values["controller"].ToString().ToLower(); string action = filterContext.RouteData.Values["action"].ToString().ToLower(); //登录 if (isAllowAnyone(controller, action)) { return; } if (!filterContext.RequestContext.HttpContext.User.Identity.IsAuthenticated) { RedirectToLogin(filterContext); return; } if (isRequiredLogin(controller, action)) { return; } string requestUrl = filterContext.HttpContext.Request.Url.AbsolutePath.ToLower(); requestUrl = Regex.Replace(requestUrl, @"(&|\?)f=\d+", "", RegexOptions.IgnoreCase); using (PublicService ps = new PublicService()) { IList <SysFunc> userFuncs = ps.User.GetUserFuncs(AuthorizationService.CurrentUserID); if (userFuncs == null || userFuncs.Count == 0) { RedirectToUnauthorized(filterContext); } else { //SysFunc func1 = userFuncs.Where(p => p.ID == "0103").FirstOrDefault(); SysFunc func = userFuncs.Where( p => !string.IsNullOrEmpty(p.URL) && p.LowerUrls.Where(u => u.StartsWith(requestUrl)).Count() > 0) .FirstOrDefault(); if (func == null) { RedirectToUnauthorized(filterContext); } } } }
public async Task <List <PublicServiceData> > GetDataOfAsync(PublicService ps, EidCard eid) { var lst = new List <PublicServiceData>(); ps.ContractNames = await GetContractNames(ps); foreach (var contractName in ps.ContractNames) { lst.Add(await GetPSDOfContract(eid.RNN, contractName)); } return(lst); }
public ActionResult DeleteConfirmed(int id) { Service services = db.Services.Find(id); PublicService publicService = db.PublicServices.Where(a => a.ServiceId.Equals(id)).FirstOrDefault(); if (publicService != null) { db.Entry(publicService).State = EntityState.Deleted; } db.Services.Remove(services); db.SaveChanges(); return(RedirectToAction("Index")); }
//private ReturnMsg _ReturnMsg; public SystemController() { var unitOfWork = new EFUnitOfWork(); _UserService = new AspNetUsersService(unitOfWork); _MemberService = new MemberService(unitOfWork); _logSvc = new LoggingService(unitOfWork); _menuSide = new MenuSideListService(unitOfWork); _publicService = new PublicService(); // _ReturnMsg = new ReturnMsg(); _actionName = ""; // this.ControllerContext.RouteData.Values["action"].ToString(); _controllerName = ""; // this.ControllerContext.RouteData.Values["controller"].ToString(); }
/// <summary> /// 获取富文本框内容 /// </summary> /// <param name="formid">表单ID</param> /// <returns>string</returns> public static string GetContent(string formid) { string result = ""; PublicService pservice = new PublicService(); byte[] content = pservice.GetContent(formid); if (content != null) { //result = System.Text.Encoding.Default.GetString(content); result = System.Text.Encoding.UTF8.GetString(content); } return result; }
/// <summary> /// 获取富文本框内容 /// </summary> /// <param name="formid">表单ID</param> /// <returns>string</returns> public static string GetContent(string formid) { string result = ""; PublicService pservice = new PublicService(); byte[] content = pservice.GetContent(formid); if (content != null) { //result = System.Text.Encoding.Default.GetString(content); result = System.Text.Encoding.UTF8.GetString(content); } return(result); }
public IActionResult CreatePublicService([FromBody] PublicService data) { var hasil = new OutputData() { IsSucceed = true }; data.Id = db.GetSequence <PublicService>(); data.GenerateQRCode(); hasil.IsSucceed = db.InsertData <PublicService>(data); return(Ok(hasil)); }
protected void btnSave_Click(object sender, EventArgs e) { if (AuthorizationService.CurrentUserInfo.UserType != "51") { ClientScript.RegisterStartupScript(this.GetType(), "valid", "logonvalid()", true); } else { ZLERP.Model.LinkManRecord linkManRecord = new ZLERP.Model.LinkManRecord(); linkManRecord.Content = this.Content.Text.Trim(); PublicService ps = new PublicService(); ps.GetGenericService <ZLERP.Model.LinkManRecord>().Add(linkManRecord); BindRepeater(); ClientScript.RegisterStartupScript(this.GetType(), "success", "savesuccess()", true); } }
/// <summary> /// 取得dropdownlist数据 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <param name="name"></param> /// <param name="textField"></param> /// <param name="valueField"></param> /// <param name="orderBy"></param> /// <param name="ascending"></param> /// <param name="condition"></param> /// <param name="nullValue">空项值,为null则不生成空选择项,非null时,空选择项的值为指定的nullValue</param> /// <returns></returns> static IEnumerable <SelectListItem> SelectListDataHelper <TEntity>( string textField, string valueField, string condition, string orderBy, bool ascending, string nullValue) where TEntity : Entity { if (string.IsNullOrEmpty(textField) || string.IsNullOrEmpty(valueField)) { throw new ApplicationException(string.Format("{0}:textField,valueField", Lang.Error_ParameterRequired)); } //return CacheHelper.GetCacheItem<IEnumerable<SelectListItem>>( // CacheHelper.GetCacheKey<TEntity>(MethodInfo.GetCurrentMethod().Name, textField,valueField, condition, orderBy, ascending.ToString()), // lock_SelectListData, // delegate // { using (PublicService ps = new PublicService()) { var data = ps.GetGenericService <TEntity>().All(new List <string> { textField, valueField }, condition, orderBy, ascending); var query = from object item in data let value = Eval(item, valueField) select new SelectListItem { Value = value, Text = Eval(item, textField), Selected = false }; var listItems = query.ToList(); //插入空项 if (nullValue != null) { listItems.Insert(0, new SelectListItem { Text = "", Value = nullValue }); } return(listItems); } // }); }
/// <summary> /// 物资入库-修改 /// </summary> /// <param name="entity"></param> /// <returns></returns> public override ActionResult Update(GoodsIn entity) { //添加新的历史记录 if (s == null) { s = new PublicService(); } GoodsInHistory history = new GoodsInHistory(); history.Builder = entity.Builder; history.BuildTime = entity.BuildTime; history.GoodsID = entity.GoodsID; history.GoodsInIDHistory = entity.ID; history.InNum = entity.InNum; history.InPrice = entity.InPrice; history.InTime = entity.InTime; history.Lifecycle = entity.Lifecycle; history.Modifier = entity.Modifier; history.ModifyTime = entity.ModifyTime; history.Operator = entity.Operator; history.Remark = entity.Remark; history.SupplyName = entity.SupplyName; history.TransportName = entity.TransportName; history.action_u = "更新"; history.GoodsName = s.GoodsIn.GetName(entity.GoodsID); s.GoodsInHistory.Add(history); ActionResult r = base.Update(entity); //this.service.GoodsInfo.SetM(entity.GoodsID); ThreadID tid = new ThreadID(); tid.currentDate = entity.InTime; tid.typeID = entity.GoodsID; //辅材id tid.typename = "1"; //辅材 this.service.ThreadID.Add(tid); return(r); }
static void Main(string[] args) { // hello world example dynamic helloWorld = new HelloWorld.HelloWorld(); helloWorld.HelloWorldCall(); string text = "test"; helloWorld.PrintIfArgNotNull(text); helloWorld.PrintIfArgNotNull(null); // logging example var entity = new TestEntity { Name = "Jon", Number = 99 }; dynamic repository = new TestRepository(); repository.Save(entity); // exception handling example dynamic publicService = new PublicService { ServiceName = "TestService", Port = 1234, SessionId = "123908sdfhjkgdfg" }; try { publicService.Send(entity); } catch { Console.WriteLine("We catched original exception after 'exception aspect' did his job."); } Console.Read(); }
public IActionResult UpdatePublicService([FromBody] PublicService data) { var hasil = new OutputData() { IsSucceed = true }; var datas = (from c in db.GetAllData <PublicService>() where c.Id == data.Id select c).ToList(); if (datas != null && datas.Count() > 0) { var seldata = datas[0]; data.Id = seldata.Id; hasil.IsSucceed = db.InsertData <PublicService>(data); } else { hasil.IsSucceed = false; hasil.ErrorMessage = "user is not exists"; } return(Ok(hasil)); }
public override ActionResult Index() { HomeViewModel hvm = new HomeViewModel(); //所有系统项配置 hvm.SysConfigs = this.service.SysConfig.GetAllSysConfigs(); IList <SysFunc> funcs; //获取用户权限方案 PublicService ps = new PublicService(); SysConfig config = ps.SysConfig.GetSysConfig(Model.Enums.SysConfigEnum.AuthScheme); if (config == null) { config.ConfigValue = "1"; } //用户权限方案一 if (config.ConfigValue == "1") { funcs = this.service.User.GetUserFuncs(AuthorizationService.CurrentUserID); ViewBag.AuthScheme = "启用权限方案一"; } //用户权限方案二 else { funcs = this.service.User.GetUserFuncs2(AuthorizationService.CurrentUserID); ViewBag.AuthScheme = "启用权限方案二"; } //当前用户根目录列表 hvm.RootFuncs = funcs.Where(f => string.IsNullOrEmpty(f.ParentID) && !f.IsDisabled) .Select(p => new ZLERP.Model.ViewModels.HomeViewModel.MenuInfo() { ID = p.ID, PID = p.ParentID, Name = p.FuncName, Desc = p.FuncDesc, Url = p.URL, IsL = p.IsLeaf }).ToList(); ////子菜单列表(无限级) //funcss = funcs; //subFindFunc(funcs); //var subFuncs = funcss.Select(p => new ZLERP.Model.ViewModels.HomeViewModel.MenuInfo() // { // ID = p.ID, // PID = p.ParentID, // Name = p.FuncName, // Desc = p.FuncDesc, // Url = p.Urls.FirstOrDefault(), // IsL = p.IsLeaf // }).ToList(); //子菜单列表(有限级) var subFuncs = funcs.Where(f => !string.IsNullOrEmpty(f.ParentID) && !f.IsButton && !f.IsDisabled && (f.ID == "9501" || f.ParentID != "95")) .Select(p => new ZLERP.Model.ViewModels.HomeViewModel.MenuInfo() { ID = p.ID, PID = p.ParentID, Name = p.FuncName, Desc = p.FuncDesc, Url = p.Urls.FirstOrDefault(), IsL = p.IsLeaf }).ToList(); //当前用户子功能列表 hvm.SubFuncs = Helpers.HelperExtensions.ToJson(subFuncs); /* * IList<Dic> allDics = this.service.Dic.All("OrderNum", true); * //用于render的dics对象,dic["dicid"] 保存所有子元素 * Dictionary<string, IList<Dic>> dics = new Dictionary<string, IList<Dic>>(); * foreach (var dic in allDics.Where(p => string.IsNullOrEmpty(p.ParentID)).ToList()) * { * dics[dic.ID] = allDics.Where(p => p.ParentID == dic.ID).ToList(); * } * ViewBag.Dics = MvcHtmlString.Create(HelperExtensions.ToJson(dics)); */ //部门列表数据 ViewBag.DepartmentList = HelperExtensions.SelectListData <Department>("DepartmentName", "ID", "", "DepartmentName", true, ""); ViewData.Model = hvm; //对在线人数全局变量进行加1处理 HttpContext rq = System.Web.HttpContext.Current; rq.Application["OnLineCount"] = (int)rq.Application["OnLineCount"] + 1; ViewBag.OnLineCount = rq.Application["OnLineCount"]; return(base.Index()); }
//protected override void OnLoad(EventArgs e) //{ // base.OnLoad(e); // SysConfigs = GetSysConfig(); //} static IList <SysConfig> GetSysConfig() { PublicService ps = new PublicService(); return(ps.SysConfig.GetAllSysConfigs()); }