コード例 #1
0
ファイル: OnNextEvent.cs プロジェクト: niik/RxSpy
 public OnNextEvent(OperatorInfo operatorInfo, Type valueType, object value, int thread)
     : base(EventType.OnNext)
 {
     OperatorId = operatorInfo.Id;
     ValueType = TypeUtils.ToFriendlyName(valueType);
     Value = ValueFormatter.ToString(value, valueType);
 }
コード例 #2
0
ファイル: OperationLogEntry.cs プロジェクト: hbulzy/SYS
 public OperationLogEntry(OperatorInfo operatorInfo)
 {
     this.OperatorUserId = operatorInfo.OperatorUserId;
     this.OperatorIP = operatorInfo.OperatorIP;
     this.Operator = operatorInfo.Operator;
     this.AccessUrl = operatorInfo.AccessUrl;
     this.DateCreated = System.DateTime.UtcNow;
 }
コード例 #3
0
ファイル: OperatorFactory.cs プロジェクト: niik/RxSpy
        public static object CreateOperatorObservable(object source, Type signalType, OperatorInfo operatorInfo)
        {
            var ctor = _connectionConstructorCache.GetOrAdd(
                signalType,
                _ => new Lazy<ConstructorInfo>(() => GetOperatorConstructor(signalType)));

            return ctor.Value.Invoke(new object[] { RxSpySession.Current, source, operatorInfo });
        }
コード例 #4
0
 public void ChangeOperator(Func<IDbConnection, IDbTransaction, object, object> action, IDbContext context)
 {
     OperatorInfo item = new OperatorInfo
     {
         func = action,
         Context = context,
     };
     this.list.Add(item);
 }
コード例 #5
0
 public void ChangeOperator(Func<IDbConnection, IDbTransaction,object, object> action, IDbContext context, dynamic entity,IPropertyMap map=null)
 {
     OperatorInfo item = new OperatorInfo {
         func = action,
         Context = context,
         entity = entity,
         Map = map
     };
     this.list.Add(item);
 }
コード例 #6
0
ファイル: OnErrorEvent.cs プロジェクト: niik/RxSpy
        public OnErrorEvent(OperatorInfo operatorInfo, Exception error)
            : base(EventType.OnError)
        {
            if (error == null)
                return;

            OperatorId = operatorInfo.Id;
            ErrorType = new TypeInfo(error.GetType());
            Message = error.Message;
            StackTrace = error.StackTrace;
        }
コード例 #7
0
ファイル: CommonEventArgs.cs プロジェクト: hbulzy/SYS
 public CommonEventArgs(string eventOperationType, int applicationId)
 {
     this._eventOperationType = eventOperationType;
     this._applicationId = applicationId;
     IOperatorInfoGetter operatorInfoGetter = DIContainer.Resolve<IOperatorInfoGetter>();
     if (operatorInfoGetter == null)
     {
         throw new System.ApplicationException("IOperatorInfoGetter not registered to DIContainer");
     }
     this.operatorInfo = operatorInfoGetter.GetOperatorInfo();
 }
コード例 #8
0
 /// <summary>
 /// 获取当前操作者信息
 /// </summary>
 /// <returns></returns>
 public OperatorInfo GetOperatorInfo()
 {
     OperatorInfo operatorInfo = new OperatorInfo();
     if (HttpContext.Current == null)
         return operatorInfo;
     IUser currentUser = UserContext.CurrentUser;
     operatorInfo.OperatorIP = WebUtility.GetIP();
     operatorInfo.AccessUrl = HttpContext.Current.Request.RawUrl;
     operatorInfo.OperatorUserId = currentUser != null ? currentUser.UserId : 0;
     operatorInfo.Operator = currentUser != null ? currentUser.DisplayName : string.Empty;
     return operatorInfo;
 }
コード例 #9
0
        public void PushOperator(OperatorInfo operatorInfo)
        {
            while (_operators.TryPeek(out var left) && OperatorInfo.IsEvaluatedBefore(left.OperatorInfo, operatorInfo))
            {
                PopOperator();
            }

            bool hasLeftArguments = _operands.Count > 0;

            if (hasLeftArguments != (operatorInfo.LeftPrecedence != null))
            {
                throw new Exception("Unexpected left arguments");
            }

            var operatorNode = new OperatorNode(operatorInfo);

            while (_operands.Count > 0)
            {
                operatorNode.Children.Add(_operands.Dequeue());
            }

            _operators.Push(operatorNode);
        }
コード例 #10
0
        public async Task <TData <List <ZtreeInfo> > > GetZtreeDepartmentList(DepartmentListParam param)
        {
            var obj = new TData <List <ZtreeInfo> >();

            obj.Result = new List <ZtreeInfo>();
            List <DepartmentEntity> departmentList = await departmentService.GetList(param);

            OperatorInfo operatorInfo = await Operator.Instance.Current();

            List <long> childrenDepartmentIdList = await GetChildrenDepartmentIdList(departmentList, operatorInfo.DepartmentId.Value);

            foreach (DepartmentEntity department in departmentList.Where(p => childrenDepartmentIdList.Contains(p.Id.Value)))
            {
                obj.Result.Add(new ZtreeInfo
                {
                    id   = department.Id,
                    pId  = department.ParentId,
                    name = department.DepartmentName
                });
            }
            obj.Tag = 1;
            return(obj);
        }
コード例 #11
0
    private OperatorInfo FindOperator(Type type, string operatorName, object operand)
    {
        OperatorInfo bestMethod     = null;
        int          bestSimilarity = int.MaxValue;

        foreach (MethodInfo methodInfo in type.GetMethods())
        {
            if (!methodInfo.IsStatic)
            {
                continue;
            }
            else if (!methodInfo.Name.Equals(operatorName))
            {
                continue;
            }

            ParameterInfo[] methodParameters = methodInfo.GetParameters();
            if (methodParameters.Length != 2)
            {
                continue;
            }

            Type operandType = methodParameters[1].ParameterType;
            if (operand == null || operandType.Equals(operand.GetType()))
            {
                return(new OperatorInfo(methodInfo, operandType));
            }

            int similarity = TypeCoercer.GetTypeSimilarity(operandType, operand.GetType());
            if (similarity < bestSimilarity)
            {
                bestMethod = new OperatorInfo(methodInfo, operandType);
            }
        }

        return(bestMethod);
    }
コード例 #12
0
ファイル: Authentication.cs プロジェクト: sinncoteam/jfbroad
        /// <summary>
        ///保存用户状态
        /// </summary>
        /// <param name="userId"></param>
        void SetSession(int userId)
        {
            bool flag = false;

            if (HttpContext.Current.Session == null)
            {
                throw new ArgumentNullException("SessionState Failed");
            }

            if (HttpContext.Current.Session[UserSessionKey] == null)
            {
                flag = true;
            }
            else
            {
                OperatorInfo u = HttpContext.Current.Session[UserSessionKey] as OperatorInfo;
                if (u.Id != userId)
                {
                    flag = true;
                }
            }

            if (flag)
            {
                OperatorInfo u = omService.GetById(userId);
                if (u == null)
                {
                    if (System.Web.HttpContext.Current.Request.Path != null && !System.Web.HttpContext.Current.Request.Path.ToLower().Contains("user/logout"))
                    {
                        System.Web.HttpContext.Current.Response.Redirect("/user/logout");
                    }
                    return;
                }
                HttpContext.Current.Session[UserSessionKey] = u;
            }
        }
コード例 #13
0
        public async Task Create()
        {
            this.Id = IdGeneratorHelper.Instance.GetId();

            this.BaseIsDelete = 0;
            this.BaseVersion  = 0;
            if (this.BaseCreateTime == null)
            {
                this.BaseCreateTime = DateTime.Now;
            }
            if (this.BaseModifyTime == null)
            {
                this.BaseModifyTime = DateTime.Now;
            }
            if (this.BaseCreatorId == null || this.BaseModifierId == null)
            {
                OperatorInfo user = await Operator.Instance.Current(Token);

                if (user != null)
                {
                    this.BaseCreatorId  = user.UserId;
                    this.BaseModifierId = user.UserId;
                }
                else
                {
                    if (this.BaseCreatorId == null)
                    {
                        this.BaseCreatorId = 0;
                    }
                    if (this.BaseModifierId == null)
                    {
                        this.BaseModifierId = 0;
                    }
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// 获取 datetime的前一次结算时间
        /// </summary>
        /// <param name="operatorID"></param>
        /// <param name="datetime"></param>
        /// <returns></returns>
        public DateTime?GetPreSettleDateTime(string operatorID, DateTime datetime)
        {
            OperatorInfo operatorInfo = null;

            if (!string.IsNullOrEmpty(operatorID))
            {
                operatorInfo              = new OperatorInfo();
                operatorInfo.OperatorID   = operatorID;
                operatorInfo.OperatorName = operatorID;
            }

            RecordSearchCondition search = new RecordSearchCondition();

            search.RecordDateTimeRange = new DateTimeRange(DateTime.MinValue.AddYears(1900), datetime.AddSeconds(-1));
            search.Operator            = operatorInfo;
            List <OperatorSettleLog> logs = provider.GetItems(search).QueryObjects;

            if (logs != null && logs.Count > 0)
            {
                DateTime log = logs.Max(l => l.SettleDateTime);
                return(log);
            }
            return(null);
        }
コード例 #15
0
        public async Task <IActionResult> Index()
        {
            await GetMaxAVCount();

            OperatorInfo operatorInfo = await Operator.Instance.Current();

            TData <List <MenuEntity> > objMenu = await menuBLL.GetList(null);

            List <MenuEntity> menuList = objMenu.Data;

            menuList = menuList.Where(p => p.MenuStatus == StatusEnum.Yes.ParseToInt()).ToList();

            if (operatorInfo.IsSystem != 1)
            {
                TData <List <MenuAuthorizeInfo> > objMenuAuthorize = await menuAuthorizeBLL.GetAuthorizeList(operatorInfo);

                List <long?> authorizeMenuIdList = objMenuAuthorize.Data.Select(p => p.MenuId).ToList();
                menuList = menuList.Where(p => authorizeMenuIdList.Contains(p.Id)).ToList();
            }

            ViewBag.MenuList     = menuList;
            ViewBag.OperatorInfo = operatorInfo;
            return(View());
        }
コード例 #16
0
        private void ItemSearching_Handler(object sender, EventArgs e)
        {
            CardEventSearchCondition con = new CardEventSearchCondition();

            con.RecordDateTimeRange       = new DateTimeRange();
            con.RecordDateTimeRange.Begin = this.ucDateTimeInterval1.StartDateTime;
            con.RecordDateTimeRange.End   = this.ucDateTimeInterval1.EndDateTime;
            con.CardType        = this.comCardType.SelectedCardType;
            con.CardCertificate = this.txtCertificate.Text;
            if (carTypeComboBox1.SelectedIndex > 0)
            {
                con.CarType = this.carTypeComboBox1.SelectedCarType;
            }
            con.OwnerName = txtOwnerName.Text;
            con.CardID    = this.txtCardID.Text.Trim();
            OperatorInfo opt = this.comOperator.SelectecOperator;

            if (opt != null)
            {
                con.Operator = opt;
            }
            con.Source   = this.ucEntrance1.SelectedEntrances;
            con.CarPlate = this.txtCarPlate.Text;

            CardEventBll bll = new CardEventBll(AppSettings.CurrentSetting.ParkConnect);
            QueryResultList <CardEventRecord> result = bll.GetCardEvents(con);

            if (result.Result == ResultCode.Successful)
            {
                ShowReportsOnGrid(result.QueryObjects);
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
コード例 #17
0
        /// <summary>
        /// 修改操作员,如果操作员编号已被使用,抛出InvalidOperationException
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public CommandResult Update(OperatorInfo info)
        {
            List <OperatorInfo> allOpt = GetAllOperators().QueryObjects;

            if (allOpt.Exists(opt => opt.OperatorID != info.OperatorID && opt.OperatorName == info.OperatorName))
            {
                throw new InvalidOperationException(string.Format(Resource1.OperatorBll_NamebeUsed, info.OperatorName));
            }
            if (info.OperatorNum > 0 && allOpt.Exists(opt => opt.OperatorID != info.OperatorID && opt.OperatorNum == info.OperatorNum))
            {
                throw new InvalidOperationException(string.Format(Resource1.OperatorBll_NumbeUsed, info.OperatorNum));
            }

            OperatorInfo original = GetByID(info.OperatorID).QueryObject;

            if (original != null)
            {
                return(provider.Update(info, original));
            }
            else
            {
                return(new CommandResult(ResultCode.NoRecord, ResultCodeDecription.GetDescription(ResultCode.NoRecord)));
            }
        }
コード例 #18
0
        public async Task <OperatorInfo> Current(string token = "")
        {
            OperatorInfo user = null;

            // 如果没传token,就拿请求中的token
            if (token.IsEmpty())
            {
                token = GetToken();
            }

            if (string.IsNullOrEmpty(token))
            {
                return(user);
            }

            user = _cache.Get <OperatorInfo>(_userCacheKeyFix + token);

            if (user == null)
            {
                user = await _userService.GetUserByToken(token);
            }

            return(user);
        }
コード例 #19
0
ファイル: Operator.cs プロジェクト: Evil2017/TestCenter
        private string TokenName     = "UserToken"; //cookie name or session name

        public async Task AddCurrent(string token)
        {
            switch (LoginProvider)
            {
            case "Cookie":
                new CookieHelper().WriteCookie(TokenName, token);
                break;

            case "Session":
                new SessionHelper().WriteSession(TokenName, token);
                break;

            case "WebApi":
                OperatorInfo user = await new DataRepository().GetUserByToken(token);
                if (user != null)
                {
                    CacheFactory.Cache.SetCache(token, user);
                }
                break;

            default:
                throw new Exception("未找到LoginProvider配置");
            }
        }
コード例 #20
0
        /// <summary>
        /// 处理超速记录
        /// </summary>
        /// <param name="info">未处理的超速记录</param>
        /// <param name="operatorInfo">处理人员</param>
        /// <param name="dateTime">处理时间</param>
        /// <param name="memo">处理备注信息</param>
        /// <returns></returns>
        public CommandResult SpeedingProcessing(SpeedingRecord info, OperatorInfo operatorInfo, DateTime dateTime, string memo)
        {
            if (info != null)
            {
                SpeedingLog log = new SpeedingLog();
                log.SpeedingID       = info.SpeedingID;
                log.SpeedingDateTime = info.SpeedingDateTime;
                log.PlateNumber      = info.PlateNumber;
                log.Place            = info.Place;
                log.Speed            = info.Speed;
                log.Photo            = info.Photo;
                log.Memo             = info.Memo;
                log.DealOperatorID   = operatorInfo.OperatorID;
                log.DealDateTime     = dateTime;
                log.DealMemo         = memo;

                IUnitWork            unitWork   = ProviderFactory.Create <IUnitWork>(_repoUri);
                ISpeedingLogProvider ilProvider = ProviderFactory.Create <ISpeedingLogProvider>(_repoUri);
                ilProvider.Insert(log, unitWork);
                provider.Delete(info, unitWork);
                return(unitWork.Commit());
            }
            return(new CommandResult(ResultCode.NoRecord));
        }
コード例 #21
0
        public async Task <IActionResult> Index()
        {
            OperatorInfo operatorInfo = await Operator.Instance.Current();

            TData <List <MenuEntity> > objMenu = await baseMenuBLL.GetList(null);

            List <MenuEntity> menuList = objMenu.Result;

            menuList = menuList.Where(p => p.MenuStatus == StatusEnum.Yes.ParseToInt()).ToList();

            if (operatorInfo.IsSystem != 1)
            {
                TData <List <MenuAuthorizeInfo> > objMenuAuthorize = await new MenuAuthorizeBLL().GetAuthorizeList(operatorInfo);
                List <long?> authorizeMenuIdList = objMenuAuthorize.Result.Select(p => p.MenuId).ToList();
                menuList = menuList.Where(p => authorizeMenuIdList.Contains(p.Id)).ToList();
            }

            ViewBag.MenuList       = menuList;
            ViewBag.UserId         = operatorInfo.UserId;
            ViewBag.UserName       = operatorInfo.UserName;
            ViewBag.DepartmentName = operatorInfo.DepartmentName;
            ViewBag.Portrait       = operatorInfo.Portrait;
            return(View());
        }
コード例 #22
0
 public OnCompletedEvent(OperatorInfo operatorInfo)
     : base(EventType.OnCompleted)
 {
     OperatorId = operatorInfo.Id;
 }
コード例 #23
0
        public async Task <List <Response_OrderTerIssue_ChartLine> > GetListGroup(OrderTerIssueListParam param, OperatorInfo user)
        {
            /*
             * var expression = ListFilter(param);
             * var list= await this.BaseRepository().FindList(expression, pagination);
             * return list.ToList();
             */
            StringBuilder sql  = CreateListGropuSql(param, user);
            var           data = await this.BaseRepository().FindList <Response_OrderTerIssue_ChartLine>(sql.ToString());

            return(data.ToList <Response_OrderTerIssue_ChartLine>());
        }
コード例 #24
0
        public async Task <List <OrderTerIssueEntity> > GetList(OrderTerIssueListParam param, OperatorInfo user)
        {
            var expression = ListFilter(param);
            var list       = await this.BaseRepository().FindList(expression);

            return(list.ToList());
        }
コード例 #25
0
        public async Task <TData <List <Response_OrderTerIssue_ChartLine> > > GetListGroupChart(OrderTerIssueListParam param, OperatorInfo user)
        {
            TData <List <Response_OrderTerIssue_ChartLine> > obj = new TData <List <Response_OrderTerIssue_ChartLine> >();

            List <Response_OrderTerIssue_ChartLine> list = await orderTerIssueService.GetListGroup(param, user);

            obj.Total = list.Count;
            obj.Data  = list;
            obj.Tag   = 1;
            if (obj.Total <= 0)
            {
                obj.Message = "没有查询到数据";
            }
            return(obj);
        }
コード例 #26
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if((Request.QueryString["equipid"] == null) && (Request.QueryString["orderid"] == null))
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    OrderId = Convert.ToInt32(Request.QueryString["orderid"]);
                    EquipId = Convert.ToInt32(Request.QueryString["equipid"]);
                }
                catch(FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                NextBackControl.BackText = "<< Back";
                NextBackControl.BackPage = "ok_editNote.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString();
                NextBackControl.NextText = "  Finish  ";
                NextBackControl.sCSSClass = "ok_input_button";

                op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);

                if(!IsPostBack)
                {
                    lblFirstName.Text = op.FirstName;
                    equip = new clsEquipment();
                    equip.iOrgId = OrgId;
                    equip.iId = EquipId;
                    if(equip.GetEquipInfo() != -1)
                    {
                        lblEquipId.Text = equip.sEquipId.Value;
                        lblEquipType.Text = equip.sType.Value;
                    }
                    else
                    {
                        Session["lastpage"] = "ok_editNote.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString();
                        Session["error"] = _functions.ErrorMessage(102);
                        Response.Redirect("error.aspx", false);
                        return;
                    }
                    order = new clsWorkOrders();
                    order.iOrgId = OrgId;
                    order.iId = OrderId;
                    repInstructions.DataSource = new DataView(order.GetInstructionByCheckIn());
                    repInstructions.DataBind();

                    if(order.bPrint.Value)
                    {
                        hlPrint.Visible = true;
                        string Url = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/")).Replace("/", "%2f");
                        Url = Url.Replace(":", "%3a");
                        hlPrint.Attributes.Add("onclick", "javascript:window.open('ReportViewer.aspx?Report=" + _functions.GetValueFromConfig("SQLRS.Folder") + "%2fCheckInReceipt&OrderId=" + OrderId.ToString() + "&OrgId=" + OrgId.ToString() + "&URL=" + Url + "', 'popupcal', 'toolbars=0');");
                    }
                    else
                        hlPrint.Visible = false;
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = "ok_editNote.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString();
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(equip != null)
                    equip.Dispose();
                if(order != null)
                    order.Dispose();
            }
        }
コード例 #27
0
ファイル: DepartmentBLL.cs プロジェクト: qia89521/myproject
        public async Task <TData <List <DepartmentEntity> > > GetList(DepartmentListParam param, OperatorInfo user)
        {
            TData <List <DepartmentEntity> > obj = new TData <List <DepartmentEntity> >();

            obj.Data = await departmentService.GetList(param);

            OperatorInfo operatorInfo = await Operator.Instance.Current();

            if (operatorInfo.IsSystem != 1)
            {
                List <long> childrenDepartmentIdList = await GetChildrenDepartmentIdList(obj.Data, operatorInfo.DepartmentId.Value);

                obj.Data = obj.Data.Where(p => childrenDepartmentIdList.Contains(p.Id.Value)).ToList();
            }
            List <UserEntity> userList = await userService.GetList(new UserListParam { UserIds = string.Join(",", obj.Data.Select(p => p.PrincipalId).ToArray()) }, user);

            foreach (DepartmentEntity entity in obj.Data)
            {
                if (entity.PrincipalId > 0)
                {
                    entity.PrincipalName = userList.Where(p => p.Id == entity.PrincipalId).Select(p => p.RealName).FirstOrDefault();
                }
                else
                {
                    entity.PrincipalName = string.Empty;
                }
            }
            obj.Tag = 1;
            return(obj);
        }
コード例 #28
0
 private void pwdTextbox_Enter(object sender, EventArgs e)
 {
     try
     {
         using (IdentityCertifyDataContext conn = new IdentityCertifyDataContext())
         {
             var res = conn.T_Users.Where(o => (o.hlpMsg == userTextbox.Text || o.userID == userTextbox.Text)).FirstOrDefault();
             if (res != null)
             {
                 lblUser.Text = res.userName.Length > 4 ? res.userName.Substring(0, 4) + ".." : res.userName;
                 operate = new OperatorInfo(res.userID, res.userName, res.hlpMsg, res.userPassword, res.roleType);
                 pwdTextbox.Focus();
             }
             else
             {
                 operate = null;
                 lblUser.Text = "";
                 userTextbox.Text = "";
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #29
0
 private void AppendName(string variable, OperatorInfo op, bool valueIsEmpty)
 {
     _Result.Append(variable);
     if (valueIsEmpty) { _Result.Append(op.IfEmpty); } else { _Result.Append("="); }
 }
コード例 #30
0
            private void AppendList(OperatorInfo op, bool explode, string variable, IEnumerable<string> list)
            {
                foreach (string item in list)
                {
                    if (op.Named && explode)
                    {
                        _Result.Append(variable);
                        _Result.Append("=");
                    }
                    AppendValue(item, 0, op.AllowReserved);

                    _Result.Append(explode ? op.Seperator : ',');
                }
                if (list.Count() > 0)
                {
                    _Result.Remove(_Result.Length - 1, 1);
                }
            }
コード例 #31
0
            private void AppendDictionary(OperatorInfo op, bool explode, IDictionary<string, string> dictionary)
            {
                foreach (string key in dictionary.Keys)
                {
                    _Result.Append(Encode(key, op.AllowReserved));
                    if (explode) _Result.Append('='); else _Result.Append(',');
                    AppendValue(dictionary[key], 0, op.AllowReserved);

                    if (explode)
                    {
                        _Result.Append(op.Seperator);
                    }
                    else
                    {
                        _Result.Append(',');
                    }
                }
                if (dictionary.Count() > 0)
                {
                    _Result.Remove(_Result.Length - 1, 1);
                }
            }
コード例 #32
0
ファイル: UriTemplate.cs プロジェクト: grbbod/drconnect-jungo
 private void AppendName(string variable, OperatorInfo op, bool valueIsEmpty)
 {
     _result.Append(variable);
     _result.Append(valueIsEmpty ? op.IfEmpty : "=");
 }
コード例 #33
0
ファイル: UriTemplate.cs プロジェクト: grbbod/drconnect-jungo
        private void AppendList(OperatorInfo op, bool explode, string variable, IEnumerable<string> list)
        {
            var strs = list as string[] ?? list.ToArray();
            foreach (var item in strs)
            {
                if (op.Named && explode)
                {
                    _result.Append(variable);
                    _result.Append("=");
                }
                AppendValue(item, 0, op.AllowReserved);

                _result.Append(explode ? op.Seperator : ',');
            }
            if (strs.Any())
            {
                _result.Remove(_result.Length - 1, 1);
            }
        }
コード例 #34
0
ファイル: UriTemplate.cs プロジェクト: grbbod/drconnect-jungo
        private void AppendDictionary(OperatorInfo op, bool explode, IDictionary<string, string> dictionary)
        {
            foreach (string key in dictionary.Keys)
            {
                _result.Append(key);
                _result.Append(explode ? '=' : ',');
                AppendValue(dictionary[key], 0, op.AllowReserved);

                _result.Append(explode ? op.Seperator : ',');
            }
            if (dictionary.Any())
            {
                _result.Remove(_result.Length - 1, 1);
            }
        }
コード例 #35
0
ファイル: ok_viewNotes.aspx.cs プロジェクト: bigWebApps/Fleet
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if(Request.QueryString["id"] == null)
                {
                    Session["lastpage"] = "ok_selectWorkOrder.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    OrderId = Convert.ToInt32(Request.QueryString["id"]);
                }
                catch(FormatException fex)
                {
                    Session["lastpage"] = "ok_selectWorkOrder.aspx";
                    Session["error"] = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if(Request.UrlReferrer != null)
                {
                    m_sBack = Request.UrlReferrer.AbsoluteUri;
                    m_sBack = m_sBack.Remove(0, m_sBack.LastIndexOf("/") + 1);
                }
                else
                    m_sBack = "ok_updateSpare.aspx?id=" + OrderId.ToString();

                NextBackControl.BackText = "<< Back";
                NextBackControl.BackPage = m_sBack;
                NextBackControl.NextText = "Continue >>";
                NextBackControl.sCSSClass = "ok_input_button";

                op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);

                if(!IsPostBack)
                {
                    order = new clsWorkOrders();
                    order.iOrgId = OrgId;
                    order.iItemId = OrderId;
                    order.iNoteTypeId = (int)NoteTypes.CheckOutNote;
                    dtNotes = order.GetNotesList();
                    if(dtNotes.Rows.Count > 0)
                    {
                        repTechNotes.DataSource = new DataView(dtNotes);
                        repTechNotes.DataBind();
                    }
                    else
                    {
                        order.iId = OrderId;
                        CheckOutEquipment();
                    }
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = m_sBack;
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(order != null)
                    order.Dispose();
            }
        }
コード例 #36
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if((Request.QueryString["equipid"] == null) && (Request.QueryString["orderid"] == null))
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    OrderId = Convert.ToInt32(Request.QueryString["orderid"]);
                    EquipId = Convert.ToInt32(Request.QueryString["equipid"]);
                }
                catch(FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);

                if(!IsPostBack)
                {
                    lblFirstName.Text = op.FirstName;
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = "ok_selectSpareEquip.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString();
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
            }
        }
コード例 #37
0
        public async Task GetFare()
        {
            string url;

            if (Key == "JR-East" & Routes != null & Routes.Count != 0)
            {
                url = $"https://tokyofare.azurewebsites.net/jr?from={Routes.First().From.Name}&to={Routes.Last().To.Name}";
                string response = await RequestHelper.GetJsonString(url);

                JToken         jsonObj = JObject.Parse(response);
                List <dynamic> result  = new List <dynamic>();
                result.Add(new RailwayFare()
                {
                    IcCardFare      = (int)jsonObj["icCardFare"],
                    TicketFare      = (int)jsonObj["ticketFare"],
                    ChildIcCardFare = (int)jsonObj["childIcCardFare"],
                    ChildTicketFare = (int)jsonObj["childTicketFare"]
                });
                Fare = result.FirstOrDefault();
            }
            else if (Key == "TsukubaExpress" & Routes != null & Routes.Count != 0)
            {
                url = $"https://tokyofare.azurewebsites.net/tsukubaexpress?from={Routes.First().From.Name}&to={Routes.Last().To.Name}";
                string response = await RequestHelper.GetJsonString(url);

                JToken         jsonObj = JObject.Parse(response);
                List <dynamic> result  = new List <dynamic>();
                result.Add(new RailwayFare()
                {
                    IcCardFare      = (int)jsonObj["icCardFare"],
                    TicketFare      = (int)jsonObj["ticketFare"],
                    ChildIcCardFare = (int)jsonObj["childIcCardFare"],
                    ChildTicketFare = (int)jsonObj["childTicketFare"]
                });
                Fare = result.FirstOrDefault();
            }
            else if (Routes != null & Routes.Count != 0)
            {
                url = $"{RequestHelper.ComposeURL("GetRailwayFare")}?acl:consumerKey={await TokenHelper.GetToken("tokyochallenge")}&odpt:operator={OperatorInfo.GetCompanyByName(Key)}&odpt:fromStation={OperatorInfo.GetFormattedStationName(Key, Routes.First().FromLine.Name, Routes.First().From.Name)}&odpt:toStation={OperatorInfo.GetFormattedStationName(Key, Routes.Last().ToLine.Name, Routes.Last().To.Name)}";
                string response = await RequestHelper.GetJsonString(url);

                if (!string.IsNullOrEmpty(response))
                {
                    JToken         jsonArr = JArray.Parse(response);
                    List <dynamic> result  = new List <dynamic>();
                    foreach (var i in jsonArr)
                    {
                        result.Add(new RailwayFare()
                        {
                            IcCardFare      = (int)i["odpt:icCardFare"],
                            TicketFare      = (int)i["odpt:ticketFare"],
                            ChildIcCardFare = (int)i["odpt:childIcCardFare"],
                            ChildTicketFare = (int)i["odpt:childTicketFare"]
                        });
                    }
                    Fare = result.FirstOrDefault();
                }
            }
        }
コード例 #38
0
 public VarSpec(OperatorInfo operatorInfo)
 {
     _operatorInfo = operatorInfo;
 }
コード例 #39
0
 private void ShowOperatorRights(OperatorInfo op)
 {
 }
コード例 #40
0
        /// <summary>
        /// 检测流程
        /// </summary>
        /// <param name="entity">数据实体</param>
        /// <returns></returns>
        private ResultMsg CheckWorkFLow(OrderTerIssueEntity entity, OperatorInfo user)
        {
            ResultMsg result = new ResultMsg();

            //新增
            if (entity.Id.IsNullOrZero())
            {
                entity.ShenHeStatus = 0;
                entity.Step         = OutPutStepEnum.Validate.ParseToInt();
                result.IsSucess     = true;
            }
            else
            {
                if (entity.Step == OutPutStepEnum.Create.ParseToInt())
                {
                    if (entity.BaseCreatorId == user.UserId)
                    {
                        if (entity.ShenHeStatus == ShenHeStatusEnum.Create.ParseToInt())
                        {
                            entity.Step = OutPutStepEnum.Validate.ParseToInt();
                            //表示创建者修改
                            result.IsSucess = true;
                        }
                        else
                        {
                            result.Msg = "已经审批不可修改";
                        }
                    }
                }
                //01 到了财务审批步骤
                else if (entity.Step == OutPutStepEnum.Validate.ParseToInt())
                {
                    if (user.UserId == entity.ShenHeManId)
                    {
                        if (entity.ShenHeStatus == ShenHeStatusEnum.Refuse.ParseToInt())
                        {
                            entity.Step = OutPutStepEnum.Finish.ParseToInt();
                        }
                        else if (entity.ShenHeStatus == ShenHeStatusEnum.Past.ParseToInt())
                        {
                            entity.Step = OutPutStepEnum.Sent.ParseToInt();
                        }
                        result.IsSucess = true;
                    }
                    else
                    {
                        result.Msg = "请先财务审核才能下一步操作";
                    }
                }
                //发货阶段
                else if (entity.Step == OutPutStepEnum.Sent.ParseToInt())
                {
                    if (user.UserId == entity.SentManId)
                    {
                        entity.Step     = OutPutStepEnum.Finish.ParseToInt();
                        entity.IsSent   = SentStatusEnum.Yes.ParseToInt();
                        result.IsSucess = true;
                    }
                    else
                    {
                        result.Msg = "请售后进行操作";
                    }
                }
                //发货阶段
                else if (entity.Step == OutPutStepEnum.Finish.ParseToInt())
                {
                    result.Msg = "流程已经结束,禁止操作";
                }
            }
            return(result);
        }
コード例 #41
0
ファイル: DepartmentBLL.cs プロジェクト: qia89521/myproject
        public async Task <TData <List <ZtreeInfo> > > GetZtreeUserList(DepartmentListParam param, OperatorInfo opuser)
        {
            var obj = new TData <List <ZtreeInfo> >();

            obj.Data = new List <ZtreeInfo>();
            List <DepartmentEntity> departmentList = await departmentService.GetList(param);

            OperatorInfo operatorInfo = await Operator.Instance.Current();

            if (operatorInfo.IsSystem != 1)
            {
                List <long> childrenDepartmentIdList = await GetChildrenDepartmentIdList(departmentList, operatorInfo.DepartmentId.Value);

                departmentList = departmentList.Where(p => childrenDepartmentIdList.Contains(p.Id.Value)).ToList();
            }
            List <UserEntity> userList = await userService.GetList(null, opuser);

            foreach (DepartmentEntity department in departmentList)
            {
                obj.Data.Add(new ZtreeInfo
                {
                    id   = department.Id,
                    pId  = department.ParentId,
                    name = department.DepartmentName
                });
                List <long> userIdList = userList.Where(t => t.DepartmentId == department.Id).Select(t => t.Id.Value).ToList();
                foreach (UserEntity user in userList.Where(t => userIdList.Contains(t.Id.Value)))
                {
                    obj.Data.Add(new ZtreeInfo
                    {
                        id   = user.Id,
                        pId  = department.Id,
                        name = user.RealName
                    });
                }
            }
            obj.Tag = 1;
            return(obj);
        }
コード例 #42
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            int l_iMileage;
            try
            {
                if((Request.QueryString["equipid"] == null) && (Request.QueryString["orderid"] == null))
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    OrderId = Convert.ToInt32(Request.QueryString["orderid"]);
                    EquipId = Convert.ToInt32(Request.QueryString["equipid"]);
                }
                catch(FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                NextBackControl.BackText = "<< Back";
                NextBackControl.BackPage = "ok_selectEquipment.aspx?orderid=" + OrderId.ToString();
                NextBackControl.NextText = "Continue >>";
                NextBackControl.sCSSClass = "ok_input_button";

                op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);

                if(!IsPostBack)
                {
                    equip = new clsEquipment();
                    equip.iOrgId = OrgId;
                    equip.iId = EquipId;

                    if(equip.GetEquipInfo() != -1)
                    {
                        if(0 == Decimal.Compare(Decimal.Floor(equip.dmCurrentUnits.Value), equip.dmCurrentUnits.Value))
                            lblCurrentUnits.Text = Decimal.Floor(equip.dmCurrentUnits.Value).ToString() + " " + equip.sMeasure.Value;
                        else
                            lblCurrentUnits.Text = equip.dmCurrentUnits.Value.ToString("F") + " " + equip.sMeasure.Value;
                        //mileage
                        lblMeasure.Text = equip.sMeasure.Value;
                        lblMeasure2.Text = equip.sMeasure.Value;
                        lblMeasure3.Text = equip.sMeasure.Value;
                        lblEquipId.Text = equip.sEquipId.Value;
                        lblEquipType.Text = equip.sType.Value;
                        rvUnits.MinimumValue = equip.dmCurrentUnits.Value.ToString();
                        rvUnits.ErrorMessage = "Value must be greater than was " + equip.dmCurrentUnits.Value.ToString("F");
                    }
                    else
                    {
                        Session["lastpage"] ="ok_selectEquipment.aspx?orderid=" + OrderId.ToString();
                        Session["error"] = _functions.ErrorMessage(102);
                        Response.Redirect("error.aspx", false);
                        return;
                    }
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = "ok_selectEquipment.aspx?orderid=" + OrderId.ToString();
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(equip != null)
                    equip.Dispose();
            }
        }
コード例 #43
0
        public async Task <TData <string> > SaveForm(OrderTerIssueParam modelParam, OperatorInfo opuser)
        {
            TData <string> obj = new TData <string>();

            obj.SetDefault();
            try
            {
                OrderTerIssueEntity entity = new OrderTerIssueEntity();

                long num = 0;
                long.TryParse(modelParam.Id, out num);
                entity.Id = num;

                if (!entity.Id.IsNullOrZero())
                {
                    TData <OrderTerIssueEntity> tdata = await GetEntity(num);

                    entity = tdata.Data;
                }

                ClassValueCopierHelper.Copy(entity, modelParam);

                #region 补充数据
                num = 0;
                long.TryParse(modelParam.Id, out num);
                entity.Id = num;

                num = 0;
                long.TryParse(modelParam.MaterielId, out num);
                entity.MaterielId = num;


                num = 0;
                long.TryParse(modelParam.SaleId, out num);
                entity.SaleId = num;


                int saleNum = 0;
                int.TryParse(modelParam.SaleNum, out saleNum);
                entity.SaleNum = saleNum;

                decimal money = 0;
                decimal.TryParse(modelParam.SalePrice, out money);
                entity.SalePrice = money;

                money = 0;
                decimal.TryParse(modelParam.FactMoney, out money);
                entity.FactMoney = money;


                money = 0;
                decimal.TryParse(modelParam.SrcPrice, out money);
                entity.SrcPrice = money;

                saleNum = 0;
                int.TryParse(modelParam.TakeType, out saleNum);
                entity.TakeType = saleNum;

                saleNum = 0;
                int.TryParse(modelParam.ShenHeStatus, out saleNum);
                entity.ShenHeStatus = saleNum;

                num = 0;
                long.TryParse(modelParam.ShenHeManId, out num);
                entity.ShenHeManId = num;

                num = 0;
                long.TryParse(modelParam.SentManId, out num);
                entity.SentManId = num;

                if (entity.Id.IsNullOrZero())
                {
                    entity.BaseCreatorId  = long.Parse(opuser.UserIdStr);
                    entity.BaseCreateTime = DateTime.Now;
                }
                entity.ReciveAddress  = modelParam.ReciveZone + modelParam.ReciveAddre;
                entity.BaseModifyTime = DateTime.Now;
                entity.BaseModifierId = long.Parse(opuser.UserIdStr);
                #endregion

                LogHelper.Info("【SaveForm】entity:" + JsonHelper.SerializeObject(entity));
                obj = await SaveForm(entity, opuser);
            }
            catch (Exception ex)
            {
                LogHelper.Info("【SaveForm】ex:" + ex.ToString());
            }
            return(obj);
        }
コード例 #44
0
ファイル: SubscribeEvent.cs プロジェクト: niik/RxSpy
 public SubscribeEvent(OperatorInfo child, OperatorInfo parent)
     : base(EventType.Subscribe)
 {
     ChildId = child.Id;
     ParentId = parent.Id;
 }
コード例 #45
0
        public async Task <TData <List <OrderTerIssueEntity> > > GetPageList(OrderTerIssueListParam param, Pagination pagination, OperatorInfo user)
        {
            TData <List <OrderTerIssueEntity> > obj = new TData <List <OrderTerIssueEntity> >();

            obj.Data = await orderTerIssueService.GetPageList(param, pagination, user);

            obj.Total     = pagination.TotalCount;
            obj.PageTotal = pagination.TotalPage;
            obj.Tag       = 1;
            return(obj);
        }
コード例 #46
0
ファイル: ConnectedEvent.cs プロジェクト: niik/RxSpy
 public ConnectedEvent(OperatorInfo operatorInfo)
     : base(EventType.Connected)
 {
     OperatorId = operatorInfo.Id;
 }
コード例 #47
0
        /// <summary>
        /// 创建查询sql
        /// </summary>
        /// <param name="param">查询条件数据</param>
        /// <returns></returns>
        private StringBuilder CreateListSql(OrderTerIssueListParam param, OperatorInfo user)
        {
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat(" SELECT a.*");
            sql.AppendFormat(" ,b.RealName AS BaseCreatorTxt");
            sql.AppendFormat(" ,c.RealName AS ShenHeManTxt");
            sql.AppendFormat(" ,d.RealName AS SentManTxt");
            sql.AppendFormat(" ,e.MaterielName as MaterielTxt");

            sql.AppendFormat(" ,e.MaterielType as MaterielType");
            sql.AppendFormat(" ,e.MaterielDesc as MaterielDesc");
            sql.AppendFormat(" ,e.MaterielUnite as MaterielUnite");
            sql.AppendFormat(" from (");
            sql.AppendFormat("  SELECT * FROM order_ter_issue ");
            sql.AppendFormat("  where 1=1 ");
            if (param != null)
            {
                if (param.Step >= 0)
                {
                    sql.AppendFormat(" AND Step={0}", param.Step);
                }
                if (param.ShenHeStatus >= 0)
                {
                    sql.AppendFormat(" AND ShenHeStatus={0}", param.ShenHeStatus);
                }
                if (!string.IsNullOrEmpty(param.SaleTxt))
                {
                    sql.AppendFormat(" AND SaleTxt LIKE '%{0}%'", param.SaleTxt);
                }
                if (!string.IsNullOrEmpty(param.StartTime))
                {
                    sql.AppendFormat(" AND BaseCreateTime >'{0} 00:00:00'", param.StartTime);
                }
                if (!string.IsNullOrEmpty(param.EndTime))
                {
                    sql.AppendFormat(" AND BaseCreateTime <'{0} 23:59:59'", param.EndTime);
                }
            }
            sql.AppendFormat(" ) a ");

            sql.AppendFormat(" JOIN ");
            sql.AppendFormat(" ( ");
            sql.AppendFormat("   SELECT Id,RealName from sysuser ");
            sql.AppendFormat("   WHERE 1=1 ");
            sql.AppendFormat(" ) b");
            sql.AppendFormat(" on a.SaleId  = b.Id ");

            sql.AppendFormat(" LEFT JOIN ");
            sql.AppendFormat(" ( ");
            sql.AppendFormat("   SELECT Id,RealName from sysuser ");
            sql.AppendFormat("   WHERE 1=1 ");
            sql.AppendFormat(" ) c");
            sql.AppendFormat(" on a.ShenHeManId  = c.Id ");

            sql.AppendFormat(" LEFT JOIN ");
            sql.AppendFormat(" ( ");
            sql.AppendFormat("   SELECT Id,RealName from sysuser ");
            sql.AppendFormat("   WHERE 1=1 ");
            sql.AppendFormat(" ) d");
            sql.AppendFormat(" on a.SentManId  = d.Id ");

            sql.AppendFormat(" JOIN ");
            sql.AppendFormat(" ( ");
            sql.AppendFormat("   SELECT Id,MaterielName,MaterielType,MaterielDesc,MaterielUnite from order_materiel ");
            sql.AppendFormat("   WHERE 1=1 ");
            sql.AppendFormat(" ) e");
            sql.AppendFormat(" on a.MaterielId  = e.Id ");
            return(sql);
        }
コード例 #48
0
ファイル: ok_mainMenu2.aspx.cs プロジェクト: bigWebApps/Fleet
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if(!IsPostBack)
                {
                    OperatorInfo op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);
                    lblFirstName.Text = op.FirstName;
                    equip = new clsEquipment();
                    equip.iOrgId = OrgId;
                    equip.iUserId = op.Id;
                    repEquipments.DataSource = new DataView(equip.GetEquipListByOperator2());
                    repEquipments.DataBind();
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = "ok_mainMenu.aspx";
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(equip != null)
                    equip.Dispose();
            }
        }
コード例 #49
0
        public async Task <List <OrderTerIssueEntity> > GetPageList(OrderTerIssueListParam param, Pagination pagination, OperatorInfo user)
        {
            /*
             * var expression = ListFilter(param);
             * var list= await this.BaseRepository().FindList(expression, pagination);
             * return list.ToList();
             */
            StringBuilder sql = CreateListSql(param, user);
            //LogHelper.Info(" sql:"+sql.ToString());
            var data = await this.BaseRepository().FindList <OrderTerIssueEntity>(sql.ToString(), pagination);

            return(data.list.ToList <OrderTerIssueEntity>());
        }
コード例 #50
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if(Request.QueryString["id"] == null)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    OrderId = Convert.ToInt32(Request.QueryString["id"]);
                }
                catch(FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);

                NextBackControl.BackText = "<< Back";
                NextBackControl.BackPage = "ok_mainDetails.aspx?id=" + OrderId.ToString();
                NextBackControl.NextText = "  Continue >> ";
                NextBackControl.sCSSClass = "ok_input_button";
                if(Request.QueryString["op"] == null)
                    NextBackControl.NextEnabled = false;
                else
                {
                    Operation = Request.QueryString["op"];
                    NextBackControl.BackVisible = false;
                }

                if(!IsPostBack)
                {
                    order = new clsWorkOrders();

                    order.iOrgId = OrgId;
                    order.iId = OrderId;

                    dsIssueItems = order.GetWorkOrderIssuesItems();

                    if(dsIssueItems.Tables[0].Rows.Count > 0)
                        html_tblNoneIssues.Visible = false;
                    else
                        html_tblNoneIssues.Visible = true;

                    repIssues.DataSource = new DataView(dsIssueItems.Tables[0]);
                    repIssues.DataBind();

                    if(dsIssueItems.Tables[1].Rows.Count > 0)
                        html_tblNonePMItems.Visible = false;
                    else
                        html_tblNonePMItems.Visible = true;

                    repPMItems.DataSource = new DataView(dsIssueItems.Tables[1]);
                    repPMItems.DataBind();

                    if(dsIssueItems.Tables[2].Rows.Count > 0)
                    {
                        html_tblNoneInspections.Visible = false;
                        if(dsIssueItems.Tables[3].Rows.Count == 1)
                            lblInspectionTitle.Text = "Serviced Items of " + dsIssueItems.Tables[2].Rows[0]["InspectionName"].ToString();
                        repInspectItems.DataSource = new DataView(dsIssueItems.Tables[2]);
                        repInspectItems.DataBind();
                    }
                    else
                    {
                        lblInspectionTitle.Text = "Serviced Inspections";
                        if(dsIssueItems.Tables[3].Rows.Count > 0)
                        {
                            html_tblNoneInspections.Visible = false;
                            repInspections.DataSource = new DataView(dsIssueItems.Tables[3]);
                            repInspections.DataBind();
                        }
                        else
                            html_tblNoneInspections.Visible = true;
                    }

                    if(order.GetEquipInfo() == -1)
                    {
                        Session["lastpage"] = "ok_mainDetails.aspx?id=" + OrderId.ToString();
                        Session["error"] = _functions.ErrorMessage(102);
                        Response.Redirect("error.aspx", false);
                        return;
                    }
                    btnAddIssue.Attributes.Add("onclick", "javascript:document.location='ok_addIssues.aspx?op=AddIssueReOpen&orderid=" + OrderId.ToString() + "&equipid=" + order.iEquipId.Value.ToString() + "'");
                    btnAddComment.Attributes.Add("onclick", "javascript:document.location='ok_editNote.aspx?op=AddCommentReOpen&orderid=" + OrderId.ToString() + "&equipid=" + order.iEquipId.Value.ToString() + "'");
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = "ok_mainDetails.aspx?id=" + OrderId.ToString();
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(order != null)
                    order.Dispose();
            }
        }
コード例 #51
0
        public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            string       action = context.RouteData.Values["Action"].ParseToString();
            OperatorInfo user   = await Operator.Instance.Current();

            if (GlobalContext.SystemConfig.Demo)
            {
                if (context.HttpContext.Request.Method.ToUpper() == "POST")
                {
                    if (action.ToUpper() != "LoginJson".ToUpper() && action.ToUpper() != "CodePreviewJson".ToUpper())
                    {
                        TData obj = new TData();
                        obj.Message    = "演示模式,不允许操作";
                        context.Result = new CustomJsonResult {
                            Value = obj
                        };
                        return;
                    }
                }
            }

            var resultContext = await next();

            sw.Stop();
            string           ip            = NetHelper.Ip;
            LogOperateEntity operateEntity = new LogOperateEntity();
            var    areaName       = context.RouteData.DataTokens["area"] + "/";
            var    controllerName = context.RouteData.Values["controller"] + "/";
            string currentUrl     = "/" + areaName + controllerName + action;

            if (action.ParseToString().ToLower() != "GetServerJson".ToLower() && action.ParseToString().ToLower() != "Error".ToLower())
            {
                #region 获取请求参数
                switch (context.HttpContext.Request.Method.ToUpper())
                {
                case "GET":
                    operateEntity.ExecuteParam = context.HttpContext.Request.QueryString.Value.ParseToString();
                    break;

                case "POST":
                    Dictionary <string, string> param = new Dictionary <string, string>();
                    foreach (var item in context.ActionDescriptor.Parameters)
                    {
                        var itemType = item.ParameterType;
                        if (itemType.IsClass && itemType.Name != "String")
                        {
                            PropertyInfo[] infos = itemType.GetProperties();
                            foreach (PropertyInfo info in infos)
                            {
                                if (info.CanRead)
                                {
                                    var propertyValue = context.HttpContext.Request.Form[info.Name];
                                    if (!param.ContainsKey(info.Name))
                                    {
                                        if (!string.IsNullOrEmpty(propertyValue))
                                        {
                                            param.Add(info.Name, propertyValue);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (param.Count > 0)
                    {
                        operateEntity.ExecuteUrl  += context.HttpContext.Request.QueryString.Value.ParseToString();
                        operateEntity.ExecuteParam = TextHelper.GetSubString(JsonConvert.SerializeObject(param), 8000);
                    }
                    else
                    {
                        operateEntity.ExecuteParam = context.HttpContext.Request.QueryString.Value.ParseToString();
                    }
                    break;
                }
                #endregion

                #region 异常获取
                StringBuilder sbException = new StringBuilder();
                if (resultContext.Exception != null)
                {
                    Exception exception = resultContext.Exception;
                    sbException.AppendLine(exception.Message);
                    while (exception.InnerException != null)
                    {
                        sbException.AppendLine(exception.InnerException.Message);
                        exception = exception.InnerException;
                    }
                    sbException.AppendLine(resultContext.Exception.StackTrace);
                    operateEntity.LogStatus = OperateStatusEnum.Fail.ParseToInt();
                }
                else
                {
                    operateEntity.LogStatus = OperateStatusEnum.Success.ParseToInt();
                }
                #endregion

                #region 日志实体
                if (user != null)
                {
                    operateEntity.BaseCreatorId = user.UserId;
                }

                operateEntity.ExecuteTime   = sw.ElapsedMilliseconds.ParseToInt();
                operateEntity.IpAddress     = ip;
                operateEntity.ExecuteUrl    = currentUrl.Replace("//", "/");
                operateEntity.ExecuteResult = TextHelper.GetSubString(sbException.ToString(), 4000);
                #endregion

                Action taskAction = async() =>
                {
                    // 让底层不用获取HttpContext
                    operateEntity.BaseCreatorId = operateEntity.BaseCreatorId ?? 0;

                    // 耗时的任务异步完成
                    operateEntity.IpLocation = IpLocationHelper.GetIpLocation(ip);
                    await new LogOperateBLL().SaveForm(operateEntity);
                };
                AsyncTaskHelper.StartTask(taskAction);
            }
        }
コード例 #52
0
        void ProcessExpression(StringBuilder currentExpression)
        {
            if (currentExpression.Length == 0)
            {
                this._ErrorDetected = true;
                this._Result.Append("{}");
                return;
            }

            OperatorInfo op = GetOperator(currentExpression[0]);

            var firstChar = op.Default ? 0 : 1;


            var varSpec = new VarSpec(op);

            for (int i = firstChar; i < currentExpression.Length; i++)
            {
                char currentChar = currentExpression[i];
                switch (currentChar)
                {
                case '*':
                    varSpec.Explode = true;
                    break;

                case ':':     // Parse Prefix Modifier
                    var prefixText = new StringBuilder();
                    currentChar = currentExpression[++i];
                    while (currentChar >= '0' && currentChar <= '9' && i < currentExpression.Length)
                    {
                        prefixText.Append(currentChar);
                        i++;
                        if (i < currentExpression.Length)
                        {
                            currentChar = currentExpression[i];
                        }
                    }
                    varSpec.PrefixLength = int.Parse(prefixText.ToString());
                    i--;
                    break;

                case ',':
                    var  success = this.ProcessVariable(varSpec);
                    bool isFirst = varSpec.First;
                    // Reset for new variable
                    varSpec = new VarSpec(op);
                    if (success || !isFirst)
                    {
                        varSpec.First = false;
                    }

                    break;


                default:
                    if (this.IsVarNameChar(currentChar))
                    {
                        varSpec.VarName.Append(currentChar);
                    }
                    else
                    {
                        this._ErrorDetected = true;
                    }
                    break;
                }
            }
            this.ProcessVariable(varSpec);
        }
コード例 #53
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if(Request.QueryString["id"] == null)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    OrderId = Convert.ToInt32(Request.QueryString["id"]);
                }
                catch(FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                NextBackControl.BackText = "<< Back";
                NextBackControl.BackPage = "ok_reopenWorkOrder.aspx?id=" + OrderId.ToString() + "&op=Issue";
                NextBackControl.NextText = "  Finish  ";
                NextBackControl.sCSSClass = "ok_input_button";

                op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);

                if(!IsPostBack)
                {
                    lblFirstName.Text = op.FirstName;
                    order = new clsWorkOrders();
                    order.iOrgId = OrgId;
                    order.iId = OrderId;
                    if(order.GetEquipInfo() != -1)
                    {
                        lblEquipId.Text = order.sEquipId.Value;
                        lblEquipType.Text = order.sEquipTypeName.Value;

                        dtInstructions = order.GetInstructionByReOpen();
                        repInstructions.DataSource = new DataView(dtInstructions);
                        repInstructions.DataBind();
                    }
                    else
                    {
                        Session["lastpage"] = "ok_reopenWorkOrder.aspx?id=" + OrderId.ToString() + "&op=Issue";
                        Session["error"] = _functions.ErrorMessage(102);
                        Response.Redirect("error.aspx", false);
                        return;
                    }
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = "ok_reopenWorkOrder.aspx?id=" + OrderId.ToString() + "&op=Issue";
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(order != null)
                    order.Dispose();
            }
        }
コード例 #54
0
 /// <summary>
 /// 处理外键ID
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 private object MapForeignKey(OperatorInfo info)
 {
     if (info.entity == null)
         return null;
     Map map = Maplist.SingleOrDefault(p => p.MapTablename == info.entity.GetType().Name);
     if (map == null)
      return info.entity;
     try
     {
         PropertyInfo pi =
       info.entity.GetType().GetProperties().SingleOrDefault(p => p.Name == map.MapTableCol);
         if (pi != null)
         {
             pi.SetValue(info.entity, map.id, null);
         }
     }
     catch (Exception)
     {
         throw new ArgumentException(string.Format("{0} mapping for property {1} failed.", map.MapTablename,map.MapTableCol));
     }
     return info.entity;
 }
コード例 #55
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (Request.QueryString["orderid"] == null)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"]    = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    EquipId   = Convert.ToInt32(Request.QueryString["equipid"]);
                    OrderId   = Convert.ToInt32(Request.QueryString["orderid"]);
                    sBackPage = Request.QueryString["back"];
                }
                catch (FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"]    = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                sBackURL = "ok_mainMenu.aspx";
                if (sBackPage == "maindetails")
                {
                    sBackURL = "ok_mainDetails.aspx?id=" + OrderId.ToString();
                }
                if (sBackPage == "mainmenu2")
                {
                    sBackURL = "ok_mainMenu2.aspx";
                }
                btnBack.Attributes.Add("onclick", "javascript:document.location='" + sBackURL + "'");

                if (!IsPostBack)
                {
                    OperatorInfo op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);
                    lblFirstName1.Text = lblFirstName2.Text = lblFirstName3.Text = op.FirstName;
                    equip         = new clsEquipment();
                    equip.iOrgId  = OrgId;
                    equip.iUserId = op.Id;
                    dtEquipments  = equip.GetEquipListByOperator();
                    if (dtEquipments.Rows.Count < 1)
                    {
                        // none equipments mode
                        pnlFindEquipment.Visible = true;
                    }
                    else if (dtEquipments.Rows.Count == 1)
                    {
                        // one equipment mode
                        pnlOneEquipment.Visible      = true;
                        lblEquipId.Text              = dtEquipments.Rows[0]["EquipId"].ToString();
                        lblEquipType.Text            = dtEquipments.Rows[0]["TypeName"].ToString();
                        lblMakeModel.Text            = dtEquipments.Rows[0]["MakeName"].ToString() + "/" + dtEquipments.Rows[0]["ModelName"].ToString();
                        lblYear.Text                 = dtEquipments.Rows[0]["Year"].ToString();
                        ViewState["SelectedEqiupId"] = dtEquipments.Rows[0]["Id"].ToString();
                    }
                    else if (dtEquipments.Rows.Count > 1)
                    {
                        // manu equipments mode
                        pnlManyEquipment.Visible = true;
                        repEquipments.DataSource = new DataView(dtEquipments);
                        repEquipments.DataBind();
                    }
                    if (OrderId != 0)
                    {
                        pnlFindEquipment.Visible = false;
                        pnlManyEquipment.Visible = false;
                        pnlOneEquipment.Visible  = true;
                        order        = new clsWorkOrders();
                        order.iOrgId = OrgId;
                        order.iId    = OrderId;
                        if (order.GetEquipInfo() == -1)
                        {
                            Session["lastpage"] = sBackURL;
                            Session["error"]    = _functions.ErrorMessage(120);
                            Response.Redirect("error.aspx", false);
                        }
                        else
                        {
                            lblEquipId.Text              = order.sEquipId.Value;
                            lblEquipType.Text            = order.sEquipTypeName.Value;
                            lblMakeModel.Text            = order.sEquipMakeModel.Value;
                            lblYear.Text                 = order.sEquipYear.Value;
                            ViewState["SelectedEqiupId"] = order.iEquipId.Value.ToString();
                        }
                    }
                    else
                    {
                        if (EquipId != 0)
                        {
                            pnlFindEquipment.Visible = false;
                            pnlManyEquipment.Visible = false;
                            pnlOneEquipment.Visible  = true;
                            equip.iId = EquipId;
                            if (equip.GetEquipInfo() == -1)
                            {
                                Session["lastpage"] = sBackURL;
                                Session["error"]    = _functions.ErrorMessage(102);
                                Response.Redirect("error.aspx", false);
                            }
                            else
                            {
                                lblEquipId.Text              = equip.sEquipId.Value;
                                lblEquipType.Text            = equip.sType.Value;
                                lblMakeModel.Text            = equip.sMakeModelName.Value;
                                lblYear.Text                 = equip.iYear.Value.ToString();
                                ViewState["SelectedEqiupId"] = EquipId.ToString();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = sBackURL;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (order != null)
                {
                    order.Dispose();
                }
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
コード例 #56
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if(Request.QueryString["orderid"] == null)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    EquipId = Convert.ToInt32(Request.QueryString["equipid"]);
                    OrderId = Convert.ToInt32(Request.QueryString["orderid"]);
                    sBackPage = Request.QueryString["back"];
                }
                catch(FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"] = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                sBackURL = "ok_mainMenu.aspx";
                if(sBackPage == "maindetails")
                    sBackURL = "ok_mainDetails.aspx?id=" + OrderId.ToString();
                if(sBackPage == "mainmenu2")
                    sBackURL = "ok_mainMenu2.aspx";
                btnBack.Attributes.Add("onclick","javascript:document.location='" + sBackURL + "'");

                if(!IsPostBack)
                {
                    OperatorInfo op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);
                    lblFirstName1.Text = lblFirstName2.Text = lblFirstName3.Text = op.FirstName;
                    equip = new clsEquipment();
                    equip.iOrgId = OrgId;
                    equip.iUserId = op.Id;
                    dtEquipments = equip.GetEquipListByOperator();
                    if(dtEquipments.Rows.Count < 1)
                    {
                        // none equipments mode
                        pnlFindEquipment.Visible = true;
                    }
                    else if (dtEquipments.Rows.Count == 1)
                    {
                        // one equipment mode
                        pnlOneEquipment.Visible = true;
                        lblEquipId.Text = dtEquipments.Rows[0]["EquipId"].ToString();
                        lblEquipType.Text = dtEquipments.Rows[0]["TypeName"].ToString();
                        lblMakeModel.Text = dtEquipments.Rows[0]["MakeName"].ToString() + "/" + dtEquipments.Rows[0]["ModelName"].ToString();
                        lblYear.Text = dtEquipments.Rows[0]["Year"].ToString();
                        ViewState["SelectedEqiupId"] = dtEquipments.Rows[0]["Id"].ToString();
                    }
                    else if(dtEquipments.Rows.Count > 1)
                    {
                        // manu equipments mode
                        pnlManyEquipment.Visible = true;
                        repEquipments.DataSource = new DataView(dtEquipments);
                        repEquipments.DataBind();
                    }
                    if(OrderId != 0)
                    {
                        pnlFindEquipment.Visible = false;
                        pnlManyEquipment.Visible = false;
                        pnlOneEquipment.Visible = true;
                        order = new clsWorkOrders();
                        order.iOrgId = OrgId;
                        order.iId = OrderId;
                        if(order.GetEquipInfo() == -1)
                        {
                            Session["lastpage"] = sBackURL;
                            Session["error"] = _functions.ErrorMessage(120);
                            Response.Redirect("error.aspx", false);
                        }
                        else
                        {
                            lblEquipId.Text = order.sEquipId.Value;
                            lblEquipType.Text = order.sEquipTypeName.Value;
                            lblMakeModel.Text = order.sEquipMakeModel.Value;
                            lblYear.Text = order.sEquipYear.Value;
                            ViewState["SelectedEqiupId"] = order.iEquipId.Value.ToString();
                        }
                    }
                    else
                    {
                        if(EquipId != 0)
                        {
                            pnlFindEquipment.Visible = false;
                            pnlManyEquipment.Visible = false;
                            pnlOneEquipment.Visible = true;
                            equip.iId = EquipId;
                            if(equip.GetEquipInfo() == -1)
                            {
                                Session["lastpage"] = sBackURL;
                                Session["error"] = _functions.ErrorMessage(102);
                                Response.Redirect("error.aspx", false);
                            }
                            else
                            {
                                lblEquipId.Text = equip.sEquipId.Value;
                                lblEquipType.Text = equip.sType.Value;
                                lblMakeModel.Text = equip.sMakeModelName.Value;
                                lblYear.Text = equip.iYear.Value.ToString();
                                ViewState["SelectedEqiupId"] = EquipId.ToString();
                            }
                        }
                    }
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = sBackURL;
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(order != null)
                    order.Dispose();
                if(equip != null)
                    equip.Dispose();
            }
        }
コード例 #57
0
        public static bool DeclareOperator(int pri, int spec, string op)
        {
            OperatorInfo i;
            if (!OperatorTable.TryGetValue(op, out i))
            {
                i = new OperatorInfo();
                OperatorTable[op] = i;
            }
            if ((isprefix(spec) && isprefix(i.specifier) && pri != i.Prefixpriority)
                || (isinfix(spec) && ((isinfix(i.specifier) && pri != i.Infixpriority) || ispostfix(i.specifier)))
                || (ispostfix(spec) && ((ispostfix(i.specifier) && pri != i.Postfixpriority) || isinfix(i.specifier))))
                throw new InvalidOperationException("Operator definition conflicts with previous definition.");

            i.specifier |= spec;
            if (isprefix(spec))
                i.Prefixpriority = pri;
            else if (isinfix(spec))
                i.Infixpriority = pri;
            else
                i.Postfixpriority = pri;

            return true;
        }
コード例 #58
0
ファイル: UrlTemplate.cs プロジェクト: OctopusDeploy/Octo.exe
        void AppendDictionary(OperatorInfo op, bool explode, IDictionary<string, string> dictionary)
        {
            foreach (var key in dictionary.Keys)
            {
                result.Append(key);
                if (explode) result.Append('=');
                else result.Append(',');
                AppendValue(dictionary[key], 0, op.AllowReserved);

                if (explode)
                {
                    result.Append(op.Seperator);
                }
                else
                {
                    result.Append(',');
                }
            }
            if (dictionary.Count() > 0)
            {
                result.Remove(result.Length - 1, 1);
            }
        }
コード例 #59
0
 public VarSpec(OperatorInfo operatorInfo)
 {
     this._operatorInfo = operatorInfo;
 }
コード例 #60
0
ファイル: ApplicationData.cs プロジェクト: davilin/LS
 public void AddToOperatorInfoes(OperatorInfo operatorInfo)
 {
     base.AddObject("OperatorInfoes", operatorInfo);
 }