public void AddEqualToDataAttr(IEnumerable<PropertyValidatorResult> propertyValidators, HtmlTag htmlTag, RequestData request)
        {
            var result = propertyValidators.FirstOrDefault(x => x.PropertyValidator is EqualValidator);
            if (result != null)
            {
                var equal = result.PropertyValidator.As<EqualValidator>();
                MessageFormatter formatter = new MessageFormatter()
                    .AppendPropertyName(result.DisplayName)
                    .AppendArgument("ComparisonValue", equal.ValueToCompare);

                string message = formatter.BuildMessage(equal.ErrorMessageSource.GetString());

                if (_msUnobtrusive)
                {
                    htmlTag.Data("val", true);
                    htmlTag.Data("val-equalto", message);
                    if (request.Accessor.PropertyNames.Length > 1)
                        htmlTag.Data("val-equalto-other", request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.MemberToCompare.Name);
                    else
                        htmlTag.Data("val-equalto-other", "*." + equal.MemberToCompare.Name);
                }
                else
                {
                    htmlTag.Data("msg-equalto", message);
                    if (request.Accessor.PropertyNames.Length > 1)
                        htmlTag.Data("rule-equalto", "#" + request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.MemberToCompare.Name);
                    else
                        htmlTag.Data("rule-equalto", "#" + equal.MemberToCompare.Name);
                }
            }
        }
Пример #2
0
        // Remote Handler
        // Key information of interest here is the Parameters array, each
        // entry represents an element of the URI, with element zero being
        // the

        public void Execute(RequestData rdata)
        {
            if (!enabled) return;

            // If we can't relate to what's there, leave it for others.

            if (rdata.Parameters.Length == 0 || rdata.Parameters[PARM_TESTID] != "remote")
                return;

            Rest.Log.DebugFormat("{0} REST Remote handler ENTRY", MsgId);

            // Remove the prefix and what's left are the parameters. If we don't have
            // the parameters we need, fail the request. Parameters do NOT include
            // any supplied query values.

            if (rdata.Parameters.Length > 1)
            {
                switch (rdata.Parameters[PARM_COMMAND].ToLower())
                {
                    case "move" :
                        DoMove(rdata);
                        break;
                    default :
                        DoHelp(rdata);
                        break;
                }
            }
            else
            {
                DoHelp(rdata);
            }
        }
Пример #3
0
        public Task<ResponseData> Request(RequestData request, CancellationToken _)
        {
            var cancellation = new CancellationTokenSource(this.timeout);

            var responseTask = this.client.Request(request, cancellation.Token);

            var completion = new TaskCompletionSource<ResponseData>();

            //when the token reaches timeout, tries to set the timeoutResponse as the result
            //if the responseTask already completed, this is ignored
            cancellation.Token.Register(() => completion.TrySetResult(this.timeoutResponse));

            //when the responseTask completes, tries to apply its exception/result properties as long as the timeout isn't reached
            responseTask.ContinueWith(t =>
            {
                if (!cancellation.IsCancellationRequested)
                {
                    if (responseTask.Exception != null)
                    {
                        completion.TrySetException(responseTask.Exception.InnerException);
                    }
                    else
                    {
                        completion.TrySetResult(responseTask.Result);
                    }
                }
            });

            return completion.Task;
        }
Пример #4
0
        public Task<ResponseData> Request(RequestData request, CancellationToken token)
        {
            var svc = this.serviceFactory.CreateService(request.Service);
            var responseTask = svc.Process(request);

            return responseTask;
        }
Пример #5
0
 public bool ServeWebRequest(RawRequestData aRawRequest, IWebRequestResponder aResponder)
 {
     string browserClass = aRawRequest.Cookies["xappbrowser"].FirstOrDefault();
     if (String.IsNullOrEmpty(browserClass) &&
         aRawRequest.Path.PathSegments.Count == 0)
     {
         //Console.WriteLine("Serving browser discrimination page.");
         Console.WriteLine("Serve {0} with discriminator.", String.Join("/", aRawRequest.Path.PathSegments));
         aResponder.SendPage("200 OK", PageSource.MakeSourceFromString(StringType.Html, IndexPage));
         return true;
     }
     string userName = aRawRequest.Cookies["xappuser"].FirstOrDefault();
     User user = null;
     if (!String.IsNullOrEmpty(userName))
     {
         iUserList.TryGetUserById(userName, out user);
     }
     RequestData requestData = new RequestData(aRawRequest.Path, aRawRequest.Method, user, browserClass);
     if (user == null)
     {
         Console.WriteLine("Serve {0} from login app.", String.Join("/", aRawRequest.Path.PathSegments));
         return iLoginApp.ServeWebRequest(requestData, aResponder);
     }
     Console.WriteLine("Serve {0} from base app.", String.Join("/", aRawRequest.Path.PathSegments));
     return iBaseApp.ServeWebRequest(requestData, aResponder);
 }
 public DownloadEventArgs(string fileLocation, Guid taskGuid, RequestData request, string errorDescription = null)
 {
     FileLocation = fileLocation;
     TaskGuid = taskGuid;
     ErrorDescription = errorDescription;
     Request = request;
 }
Пример #7
0
        public Task<ResponseData> Request(RequestData request, CancellationToken token)
        {
            this.EnsureIsRunning();

            var requestId = this.NextId();

            var callback = new TaskCompletionSource<ResponseData>();
            this.requestCallbacks[requestId] = callback;

            Task.Run(() =>
            {
                var zmqRequest = new ZmqRequest(requestId, request);
                var zmqRequestBytes = zmqRequest.ToBinary();

                this.requestsQueue.TryAdd(zmqRequestBytes);
            });

            if (token != CancellationToken.None)
            {
                token.Register(() =>
                {
                    TaskCompletionSource<ResponseData> _;
                    this.requestCallbacks.TryRemove(requestId, out _);
                });
            }

            return callback.Task;
        }
 public void AddEqualToDataAttr(IEnumerable<ValidationAttribute> propertyValidators, HtmlTag htmlTag, RequestData request)
 {
     var equal = propertyValidators.OfType<CompareAttribute>().FirstOrDefault();
     if (equal != null)
     {
         var formatErrorMessage = equal.FormatErrorMessage(request.Accessor.Name);
         if (_msUnobtrusive)
         {
             htmlTag.Data("val", true);
             htmlTag.Data("val-equalto", formatErrorMessage);
             if (request.Accessor.PropertyNames.Length > 1)
             {
                 htmlTag.Data("val-equalto-other", request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.OtherProperty);
             }
             else
             {
                 htmlTag.Data("val-equalto-other", "*." + equal.OtherProperty);
             }
         }
         else
         {
             htmlTag.Data("msg-equalto", formatErrorMessage);
             if (request.Accessor.PropertyNames.Length > 1)
                 htmlTag.Data("rule-equalto", "#" + request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.OtherProperty);
             else
                 htmlTag.Data("rule-equalto", "#" + equal.OtherProperty);
         }
     }
 }
Пример #9
0
 public void AddListen(String Request, RequestData rd)
 {
     modelData md = new modelData();
     md.Request = Request;
     md.rd = rd;
     listmode.Add(md);
 }
        public void open(JObject options, ICallback callback)
        {
            if (options != null)
            {
                var requestData = new RequestData
                {
                    Title = options.Value<string>("title"),
                    Text = options.Value<string>("share_text"),
                    Url = options.Value<string>("share_URL"),
                };

                if (requestData.Text == null && requestData.Title == null && requestData.Url == null)
                {
                    return;
                }

                RunOnDispatcher(() =>
                {
                    lock (_queue)
                    {
                        _queue.Enqueue(requestData);
                    }

                    try
                    {
                        DataTransferManager.ShowShareUI();
                        callback.Invoke("OK");
                    }
                    catch
                    {
                        callback.Invoke("not_available");
                    }
                });
            }
        }
        private RequestData GetSitecoreData()
        {
            var data = new RequestData();

            data.Add(DataKey.Request, GetRequest());
            data.Add(DataKey.Diagnostics, GetDiagnostics());
            data.Add(DataKey.PageMode, GetPageMode());
            data.Add(DataKey.Culture, GetCulture());
            data.Add(DataKey.Language, GetLanguage());
            data.Add(DataKey.Domain, GetDomain());
            data.Add(DataKey.Device, GetDevice());
            data.Add(DataKey.User, GetUser());
            data.Add(DataKey.Database, GetDatabase());
            data.Add(DataKey.Site, GetSite());
            data.Add(DataKey.ItemVisualization, GetItemVisualization());
            data.Add(DataKey.ItemTemplate, GetItemTemplate());
            data.Add(DataKey.Item, GetItem());
            data.Add(DataKey.VersionInfo, GetVersionInfo());
            data.Add(DataKey.License, GetLicense());
            data.Add(DataKey.Services, _serviceClients.ToArray());
            data.Add(DataKey.Controllers, _controllers.ToArray());
            data.Add(DataKey.UserList, _users.ToArray());

            return data;
        }
        public override void HandleGetRequest(HttpProcessor p)
        {
            Log.Debug(@"request: {0}", p.HttpUrl);

            LastRequestData = new RequestData(p.HttpMethod, p.HttpUrl, p.HttpProtocolVersionstring, p.HttpHeaders);

            SendResponse(p);
        }
Пример #13
0
        public void SetUp()
        {
            dictionary = new Dictionary<string, object>();
            aggregate = new AggregateDictionary();
            aggregate.AddDictionary(dictionary);

            request = new RequestData(aggregate);
        }
Пример #14
0
        public void SetUp()
        {
            dictionary = new Dictionary<string, object>();
            aggregate = new AggregateDictionary();
            aggregate.AddLocator(RequestDataSource.Route, key => dictionary.ContainsKey(key) ? dictionary[key] : null);

            request = new RequestData(aggregate);
        }
		private string GetAuthorizationHeader(RequestData requestData, string fullUrl, ApiRequest apiRequest)
		{
			if (requestData.RequiresSignature)
			{
				return BuildOAuthHeader(requestData, fullUrl, apiRequest.Parameters);
			}

			return "oauth_consumer_key=" + _oAuthCredentials.ConsumerKey;
		}
Пример #16
0
        public IEnumerable<ValidationAttribute> FindAttributeValidators(RequestData requestData)
        {
            if (requestData.InputType == null)
                return new List<ValidationAttribute>();

            var properties = InputPropertyMatcher.FindPropertyData(requestData);

            return properties.SelectMany(propertyInfo => propertyInfo.GetAllAttributes<ValidationAttribute>());
        }
		public string BaseUri(RequestData requestData)
		{
			if (requestData.UseHttps)
			{
				return _apiUri.SecureUri;
			}

			return _apiUri.Uri;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="RequestTelemetry"/> class.
        /// </summary>
        public RequestTelemetry()
        {
            this.Data = new RequestData();
            this.context = new TelemetryContext(this.Data.properties, new Dictionary<string, string>());

            // Initialize required fields
            this.Id = WeakConcurrentRandom.Instance.Next().ToString(CultureInfo.InvariantCulture);
            this.ResponseCode = "200";
            this.Success = true;
        }
Пример #19
0
        public void BeginRequest(RequestData data, HttpAsyncCallback callback, object state)
        {
            var request = WebRequest.CreateHttp(data.Request.Url);
            request.Method = data.Request.Method;
            //data.Request.BodySize;
            //data.Request.Comment;

            //data.Request.Cookies;
            //data.Request.Headers;
            //data.Request.HeadersSize;
            //data.Request.HttpVersion;
            //data.Request.PostData;
            //data.Request.QueryString;

            var gate = new AutoResetEvent(false);
            if (!string.IsNullOrEmpty(data.Request.PostData.Text))
            {

                request.BeginGetRequestStream(ar =>
                {
                    var postStream = request.EndGetRequestStream(ar);
                    byte[] byteArray = Encoding.UTF8.GetBytes(data.Request.PostData.Text);
                    postStream.Write(byteArray, 0, byteArray.Length);
                    postStream.Flush();

                    gate.Set();

                }, state);
            }
            else
            {
                gate.Set();
            }

            gate.WaitOne();

            var result = request.BeginGetResponse(ar =>
                {
                    var r = request.EndGetResponse(ar);
                    var s = r.GetResponseStream();
                    var d = ReadFully(s);
                    var txt = Encoding.UTF8.GetString(d, 0, d.Length);
                    data.Response = new Response()
                        {
                            Content = new Content()
                                {
                                    Text = txt
                                }
                        };
                    gate.Set();
                }, state);

            gate.WaitOne();

        }
        public override void HandlePostRequest(HttpProcessor p, StreamReader inputData)
        {
            Log.Debug(@"POST request: {0}", p.HttpUrl);

            LastRequestData = new RequestData(p.HttpMethod, p.HttpUrl, p.HttpProtocolVersionstring, p.HttpHeaders)
            {
                Data = inputData.ReadToEnd() 
            };

            SendResponse(p);
        }
        public void Returns_null_if_Sitecore_Item_not_in_request_data()
        {
            var requestData = new RequestData();
            requestData.Add(DataKey.Campaign, "Foo");

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = _sut.GetData(null);

            Assert.Null(data);
        }
Пример #22
0
   public static int CreateRequest(FlatBufferBuilder builder,
 uint id = 0,
 RequestData request_data_type = 0,
 int request_data = 0)
   {
       builder.StartObject(3);
       Request.AddRequestData(builder, request_data);
       Request.AddId(builder, id);
       Request.AddRequestDataType(builder, request_data_type);
       return Request.EndRequest(builder);
   }
		private static RequestPayload CheckForRequestPayload(RequestData requestData, IDictionary<string,string> requestParameters)
		{
			var shouldHaveRequestBody = requestData.HttpMethod.ShouldHaveRequestBody();
			var hasSuppliedARequestPayload = requestData.Payload != null;

			if (shouldHaveRequestBody && hasSuppliedARequestPayload)
			{
				return requestData.Payload;
			}

			return new RequestPayload(FormUrlEncoded, requestParameters.ToQueryString());
		}
 public void AddRegexData(IEnumerable<ValidationAttribute> propertyValidators, HtmlTag htmlTag, RequestData request)
 {
     var regex = propertyValidators.OfType<RegularExpressionAttribute>().FirstOrDefault();
     if (regex != null)
     {
         var msg = regex.ErrorMessage ?? string.Format("The field '{0}' did not match the regular expression '{1}'", request.Accessor.InnerProperty.Name, regex.Pattern);
         if (_msUnobtrusive)
             htmlTag.Data("val", true).Data("val-regex", msg).Data("val-regex-pattern", regex.Pattern);
         else
             htmlTag.Data("rule-regex", regex.Pattern).Data("msg-regex", msg);
     }
 }
Пример #25
0
        public IEnumerable<PropertyValidatorResult> FindValidators(RequestData requestData)
        {
            if (requestData.InputType == null)
                return new List<PropertyValidatorResult>();

            var baseValidator = ResolveValidator(requestData.InputType);
            if (baseValidator == null)
                return new List<PropertyValidatorResult>();

            var properties = InputPropertyMatcher.FindPropertyData(requestData);
            var validators = GetPropertyValidators(baseValidator, properties);
            return validators;
        }
        public void Return_null_if_analysis_overview_information_is_missing()
        {
            var requestData = new RequestData();
            var fieldList = new FieldList();
            fieldList.AddField("Foo", "Bar");
            requestData.Add(DataKey.Item, fieldList);

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = _sut.GetData(null);

            Assert.Null(data);
        }
        public ResponseData Auth(RequestData rData)
        {
            // Call BLL here
            var data = rData.details.Split('|');
            var response = new ResponseData
                               {
                                   Name = data[0],
                                   Age = data[1],
                                   Exp = data[2],
                                   Technology = data[3]
                               };

            return response;
        }
Пример #28
0
 public ILucidView Post(string key)
 {
     RequestData data;
     bool result;
     lock(State)
     {
         result=State.TryGetValue(key, out data);
         if(result==false)
         {
             data=new RequestData();
             data.Requests=new List<Request>();
             data.LastPosted=DateTime.Now;
             if(!State.TryAdd(key, data))
             {
                 throw new ApplicationException("concurrency error. This shouldn't have happened :( ");
             }
         }
     }
     lock(data)
     {
         if(data.Size>DataLimit)
         {
             throw new ApplicationException("you've exceeded your data limit");
         }
         data.LastPosted=DateTime.Now;
         string d=Context.BarePost;
         if(d.Length>SizeLimit)
         {
             throw new ApplicationException("Please try to restrain your content to 128K or less");
         }
         var req=new Request();
         req.Data=d;
         StringBuilder sb=new StringBuilder();
         foreach(var name in HttpContext.Current.Request.Headers.AllKeys) //LucidMVC doesn't expose this(probably because it's never needed)
         {
             foreach(var val in HttpContext.Current.Request.Headers.GetValues(name))
             {
                 sb.Append(name);
                 sb.Append(": ");
                 sb.AppendLine(val);
             }
         }
         req.Headers=sb.ToString();
         req.Method=Context.HttpMethod;
         data.Requests.Add(req);
         data.Size+=d.Length+sb.Length;
     }
     return new WrapperView("received");
 }
Пример #29
0
        public static ZmqRequest FromBinary(byte[] zmqRequestBytes)
        {
            var headerSize = BitConverter.ToInt32(zmqRequestBytes.Slice(0, 4), 0);
            var headerBytes = zmqRequestBytes.Slice(4, headerSize);
            var argumentsBytes = zmqRequestBytes.Slice(4 + headerSize, zmqRequestBytes.Length - (4 + headerSize));

            var header = Encoding.UTF8.GetString(headerBytes);
            var headerValues = header.Split(':');

            var arguments = ArrayExtensions.ToObject<object[]>(argumentsBytes);

            var request = new RequestData(headerValues[1], headerValues[2], arguments);

            return new ZmqRequest(headerValues[0], request);
        }
Пример #30
0
 protected override bool DoEdit(RequestData data)
 {
     throw new NotImplementedException();
 }
Пример #31
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         Utils.WriteTraceLog("GetDriverAddedVehicles start");
         StreamReader reader = new StreamReader(context.Request.InputStream);
         string       str    = reader.ReadToEnd();
         reader.Close();
         string     ResultCode                    = string.Empty;
         BLLDrivers bLLDrivers                    = new BLLDrivers();
         BLLBus     bLLBus                        = new BLLBus();
         Dictionary <string, object> dict         = new Dictionary <string, object>();
         JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();
         RequestData requestData                  = jsSerializer.Deserialize <RequestData>(str);
         if (requestData == null)
         {
             ResultCode = "2201";
         }
         else if (requestData.AccessToken == string.Empty || requestData.AccessToken == null)
         {
             ResultCode = "2202";
         }
         else if (requestData.DriverID == string.Empty || requestData.DriverID == null)
         {
             ResultCode = "2203";
         }
         else if (!bLLDrivers.verifyDriverID(requestData.DriverID, requestData.AccessToken))
         {
             ResultCode = "2204";
         }
         else if (bLLBus.getBusInfoByDriverID(requestData.DriverID) == null)
         {
             ResultCode = "2205";
         }
         else
         {
             ResultCode = "0000";
             List <BusInfo> busList  = bLLBus.getBusInfoByDriverID(requestData.DriverID);
             string[]       busArray = new string[busList.Count];
             for (int i = 0; i < busArray.Length; i++)
             {
                 Dictionary <string, string> dictionary = new Dictionary <string, string>();
                 dictionary.Add("BusID", busList[i].busid);
                 dictionary.Add("BusPWD", busList[i].buspwd);
                 dictionary.Add("BusName", busList[i].busname);
                 busArray[i] = jsSerializer.Serialize(dictionary);
             }
             dict.Add("VehiclesArray", busArray);
         }
         dict.Add("ResultCode", ResultCode);
         context.Response.ContentType = "text/html";
         context.Response.Write(jsSerializer.Serialize(dict));
         Utils.WriteTraceLog("GetDriverAddedVehicles ResultCode====" + ResultCode);
         Utils.WriteTraceLog("GetDriverAddedVehicles end");
     }
     catch (Exception ex)
     {
         Dictionary <string, string> dict         = new Dictionary <string, string>();
         JavaScriptSerializer        jsSerializer = new JavaScriptSerializer();
         dict.Add("ResultCode", "9991");
         context.Response.ContentType = "text/html";
         context.Response.Write(jsSerializer.Serialize(dict));
         Utils.WriteTraceLog("GetDriverAddedVehicles Exception " + ex);
         Utils.WriteTraceLog("GetDriverAddedVehicles ResultCode====9991");
         Utils.WriteTraceLog("GetDriverAddedVehicles end");
     }
 }
        private void DoSelect()
        {
            string CorpId        = string.Empty;
            string DeptId        = string.Empty;
            string ApproveName   = string.Empty;
            string ApproveUserId = string.Empty;

            if (Session["CompanyId"] != null)
            {
                CorpId = Session["CompanyId"] + "";
            }
            else
            {
                CorpId = UserEnt.Pk_corp;
            }

            DeptId = UserEnt.Pk_deptdoc;

            GetAddrEnum(CorpId, DeptId);   //获取地址枚举

            if (op == "c" || op == "create")
            {
                //corp
                SysGroup Gp          = SysGroup.TryFind(CorpId);
                string   CompanyName = Gp == null ? "" : Gp.Name;

                string DeptName = string.Empty;
                if (UserEnt.Pk_corp != CorpId)
                {
                    DeptName = "";
                }
                else if (UserEnt.Pk_corp == CorpId)
                {
                    SysGroup GpEnt = SysGroup.FindFirstByProperties(SysGroup.Prop_GroupID, UserEnt.Pk_deptdoc);
                    DeptName = "/" + GpEnt.Name;
                }


                //查找到部门配置
                string SQL = @"with GetTree
                                as
                                (
	                                select * from HR_OA_MiddleDB..fld_bmml where pk_deptdoc='{0}'
	                                union all
	                                select A.*
	                                from HR_OA_MiddleDB..fld_bmml As A 
	                                join GetTree as B 
	                                on  A.pk_deptdoc=B.pk_fathedept
                                )
	                           select deptname+',' as [text()] from getTree FOR XML PATH('') "    ;
                SQL = SQL.Replace("HR_OA_MiddleDB", Global.HR_OA_MiddleDB);
                SQL = string.Format(SQL, UserEnt.Pk_deptdoc);
                string DeptPathStr = DataHelper.QueryValue(SQL).ToString();
                DeptPathStr = string.IsNullOrEmpty(DeptPathStr) ? "" : DeptPathStr;

                SQL = @"select top 1 *,
                    case when patindex('%'+DeptName+'%','{1}')=0  then 100
                         else  patindex('%'+DeptName+'%','{1}') 
                    end  As SortIndex 
                from FL_Culture..SysApproveConfig As A
                where A.CompanyId='{0}' and TravelWelfareId is not null  order by SortIndex";
                SQL = string.Format(SQL, CorpId, DeptPathStr);
                DataTable Dt = DataHelper.QueryDataTable(SQL);

                if (Dt.Rows.Count > 0)
                {
                    ApproveName   = Dt.Rows[0]["TravelWelfareName"] + "";
                    ApproveUserId = Dt.Rows[0]["TravelWelfareId"] + "";
                }

                var Obj = new
                {
                    UserId   = UserEnt.UserID,
                    UserName = UserEnt.Name,
                    Sex      = UserEnt.Sex,
                    //Age = Ent.Age,
                    WorkNo = UserEnt.WorkNo,
                    //IndutyData = Ent.IndutyData,
                    CompanyName   = CompanyName + DeptName,
                    CompanyId     = CorpId,
                    DeptId        = DeptId,
                    DeptName      = DeptName,
                    ApproveName   = "",
                    ApproveUserId = "",
                };
                this.SetFormData(Obj);
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = UsrTravelWelfare.Find(id);
                    string SQL = @"select * from Task where PatIndex('%{0}%',EFormName)>0  and Status='4' order by FinishTime asc";
                    SQL = string.Format(SQL, id);
                    IList <EasyDictionary> taskDics = DataHelper.QueryDictList(SQL);
                    PageState.Add("Opinion", taskDics);
                    string taskId = RequestData.Get <string>("TaskId");//取审批暂存时所填写的意见
                    if (!string.IsNullOrEmpty(taskId))
                    {
                        Task tEnt = Task.Find(taskId);
                        if (tEnt.Status != 4 && !string.IsNullOrEmpty(tEnt.Description))
                        {
                            PageState.Add("UnSubmitOpinion", tEnt.Description);
                        }
                    }
                }
                this.SetFormData(ent);
                string sql = "select * from FL_Culture..UsrTravelInfo  where WelfareTravelId='{0}' order by CreateTime";
                sql = string.Format(sql, id);
                this.PageState.Add("datalist", DataHelper.QueryDictList(sql));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid = RequestData.Get("userid") + "";

            if (!string.IsNullOrEmpty(uid))
            {
                UserId   = uid;
                UserEnt  = SysUser.TryFind(uid);
                UserName = UserEnt.Name;
            }
            else
            {
                UserId   = UserInfo.UserID;
                UserEnt  = SysUser.TryFind(UserInfo.UserID);
                UserName = UserInfo.LoginName;
            }

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            GetMyTravelMoney(); //获取旅游金额

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                DoUpdate();
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                DoCreate();
                break;

            default:
                if (RequestActionString == "DeleteSub")
                {
                    DelFamilyMember();
                }
                else if (RequestActionString == "GetTimeSeg")     //获取时间段
                {
                    string CorpId = string.Empty, DeptId = string.Empty;
                    string Addr = RequestData.Get("Addr") + "";

                    if (Session["CompanyId"] != null)
                    {
                        CorpId = Session["CompanyId"] + "";
                    }
                    else
                    {
                        CorpId = UserEnt.Pk_corp;
                    }
                    DeptId = UserEnt.Pk_deptdoc;
                    this.PageState.Add("Result", GetTimeSegEnum(CorpId, DeptId, Addr));
                }
                else if (RequestActionString == "GetUsrCount")     //获取人员名额
                {
                    string configId = RequestData.Get("ConfigSetId") + "";
                    this.PageState.Add("Result", GetRemainCout(configId));
                }
                else if (RequestActionString == "GetDetailInfo")
                {
                    string CorpId = string.Empty, DeptId = string.Empty;
                    string Addr    = RequestData.Get("Addr") + "";
                    string TimeSeg = RequestData.Get("TimeSeg") + "";

                    if (Session["CompanyId"] != null)
                    {
                        CorpId = Session["CompanyId"] + "";
                    }
                    else
                    {
                        CorpId = UserEnt.Pk_corp;
                    }
                    DeptId = UserEnt.Pk_deptdoc;
                    this.PageState.Add("Result", GetUserCount(CorpId, DeptId, Addr, TimeSeg));
                }
                else if (RequestActionString == "GetTravelConfig")
                {
                    string        ConfigId = RequestData.Get("ConifgId") + "";
                    WelfareConfig Ent      = Model.WelfareConfig.TryFind(ConfigId);
                    this.PageState.Add("Info", Ent == null ? (object)"" : Ent);
                }
                else if (RequestActionString == "doAppSubmit")
                {
                    doAppSubmit();
                }
                else
                {
                    DoSelect();
                }
                break;
            }
        }
Пример #34
0
        private void DoSelect()
        {
            string where = "";
            string productType = RequestData.Get <string>("ProductType");

            if (!string.IsNullOrEmpty(productType))
            {
                SearchCriterion.AddSearch("ProductType", productType);
            }
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (item.PropertyName == "BeginDate1" && item.Value + "" != "")
                {
                    where += " and B.CreateTime>'" + item.Value + "' ";
                }
                else if (item.PropertyName == "EndDate1" && item.Value + "" != "")
                {
                    where += " and B.CreateTime<'" + (item.Value + "").Replace(" 0:00:00", " 23:59:59") + "' ";
                }
                else if (item.PropertyName == "BeginDate" && item.Value + "" != "")
                {
                    where += " and B.EndDate>'" + item.Value + "' ";
                }
                else if (item.PropertyName == "EndDate" && item.Value + "" != "")
                {
                    where += " and B.EndDate<'" + (item.Value + "").Replace(" 0:00:00", " 23:59:59") + "' ";
                }
                else if (item.Value + "" != "")
                {
                    where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                }
            }
            string userid = Aim.Portal.Web.WebPortalService.CurrentUserInfo.UserID;

            //2017-07-21 新增用户 f54d92c5-6b98-4120-8c5d-9b770125a0e5 沈艳霞
            if (userid == "97968039-a657-467b-b735-04dab4a9b60c" || userid == "c7712e33-2b20-463e-8910-8f234cf260ef" || userid == "46c5f4df-f6d1-4b36-96ac-d39d3dd65a5d" || userid == "7580578a-ce30-47ef-9a7e-95ca8ac97df3" || userid == "f54d92c5-6b98-4120-8c5d-9b770125a0e5")
            {
                where += "";
            }
            else
            {
                where += " and B.SalesmanId='" + userid + "'";
            }
            string sql = @"select A.*,B.Number,B.CName,B.Salesman,B.EndDate,C.ProductType,C.Pcn,C.CostPrice,C.SalePrice as BuyPrice,
                                (A.SalePrice/
                                ((isnull(C.SalePrice,1))*(select top(1) Rate from SHHG_AimExamine..ExchangeRate where Symbo =(select top(1) Symbo from SHHG_AimExamine..Supplier where Id=C.SupplierId ))))
                                as ProfitRate,
                                SHHG_AimExamine.dbo.fun_CaculateCostAmount(A.PId,A.Count,A.SalePrice) as CostAmount,
                                (select top(1) Rate from SHHG_AimExamine..ExchangeRate where Symbo =(select top(1) Symbo from SHHG_AimExamine..Supplier where Id=C.SupplierId )) as Rate,
                                B.CreateTime
                                from (
                                select OId,PId,PCode,PName,Isbn,sum(count) as Count,max(SalePrice) as SalePrice, sum(Amount) as Amount,max(CustomerOrderNo) as CustomerOrderNo from(
                                select OId,PId,PCode,PName,Isbn,(Count-isnull(ReturnCount,0)) as Count,SalePrice,Amount,CustomerOrderNo from SHHG_AimExamine..OrdersPart 
                                )t
                                group by PId,PCode,PName,Isbn,OId,isnull(CustomerOrderNo,'') having sum([Count])>0
                                ) as A
                                left join SHHG_AimExamine..SaleOrders as B on A.OId=B.Id 
                                left join SHHG_AimExamine..Products as C on C.Id=A.PId 
                                where (B.DeliveryState is null or B.DeliveryState<>'已作废') " + where;

            PageState.Add("OrderList", GetPageData(sql, SearchCriterion));
        }
Пример #35
0
 public override ActionResult Edit(RequestData data)
 {
     return(base.Edit(data));
 }
Пример #36
0
        public string getDataInfo(RequestData data)
        {
            DataTable resultTable = NewMethod(data);

            return(DataTableToJson(resultTable));
        }
Пример #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RequestTelemetry"/> class.
 /// </summary>
 public RequestTelemetry()
 {
     this.Data    = new RequestData();
     this.context = new TelemetryContext(this.Data.properties);
     this.Id      = Convert.ToBase64String(BitConverter.GetBytes(WeakConcurrentRandom.Instance.Next()));
 }
Пример #38
0
 public PageViewsSection(RequestData requestData) : base(requestData)
 {
 }
Пример #39
0
 public bool IsPingRequest(RequestData requestData) => requestData.PathAndQuery == string.Empty && requestData.Method == HttpMethod.HEAD;
Пример #40
0
 public bool IsSniffRequest(RequestData requestData) =>
 requestData.PathAndQuery.StartsWith(RequestPipeline.SniffPath, StringComparison.Ordinal);
Пример #41
0
 public override Task <TResponse> RequestAsync <TResponse>(RequestData requestData, CancellationToken cancellationToken) =>
 Task.FromResult(Request <TResponse>(requestData));
Пример #42
0
 public CommentProcessorPipeline(IComment commentRepository, ISettings settingsRepository, IAkismetService akismetService, IError error, CommentEntity commentEntity, RequestData requestData)
 {
     _commentRepository  = commentRepository;
     _settingsRepository = settingsRepository;
     _akismetService     = akismetService;
     _error         = error;
     _commentEntity = commentEntity;
     _requestData   = requestData;
 }
Пример #43
0
 protected override bool DoDelete(RequestData data)
 {
     return(false);
 }
Пример #44
0
        private DataTable NewMethod(RequestData data)
        {
            string sareaCode = Request.QueryString["Companyid"];

            string[] areaCodeArray = sareaCode.Split(',');
            var      table         = MonitorData.GetMonitorData("", DateTime.Parse(Request.QueryString["startTime"]), DateTime.Parse(Request.QueryString["endTime"]), "C", Request.QueryString["Companyid"], Request.QueryString["selectData"], "GasItem,WaterItem");

            List <dynamic> areaCompanyMonitorData = table.ToDynamicList();

            DataTable resultTable = new DataTable();

            resultTable.Columns.Add(new DataColumn("AREA_CODE"));
            resultTable.Columns.Add(new DataColumn("AREA_NAME"));
            resultTable.Columns.Add(new DataColumn("DATA_TIME"));
            List <string> colunmNameList = new List <string>();

            foreach (DataColumn column in table.Columns)
            {
                if (column.ColumnName.Contains("_Value"))
                {
                    resultTable.Columns.Add(new DataColumn(column.ColumnName));
                    colunmNameList.Add(column.ColumnName);
                }
            }

            foreach (string code in areaCodeArray)
            {
                List <string> existTime = new List <string>();
                areaCompanyMonitorData.ForEach(item =>
                {
                    //string dateTime = StringHelper.DynamicToString(item["DATA_TIME"]);
                    if (existTime.Contains(code))
                    {
                        return;
                    }
                    existTime.Add(code);
                    List <dynamic> list = areaCompanyMonitorData.Where(c => code == StringHelper.DynamicToString(c["ID"])).ToList();
                    if (!(list != null && list.Count > 0))
                    {
                        return;
                    }
                    //List<dynamic> list = areaCompanyMonitorData;
                    DataRow row      = resultTable.NewRow();
                    row["DATA_TIME"] = list[0]["NAME"];
                    row["AREA_CODE"] = list[0]["NAME"];
                    row["AREA_NAME"] = list[0]["NAME"];
                    colunmNameList.ForEach(column =>
                    {
                        if (string.IsNullOrEmpty(column))
                        {
                            return;
                        }
                        string[] itemCodeArray = column.Split('_');
                        string mianItemCode    = itemCodeArray[0];
                        string childItemCode   = itemCodeArray.Length > 2 ? itemCodeArray[1] : "";
                        //string calculateType = MonitorData.MonitorItemCalculateType(mianItemCode, childItemCode);
                        string calculateType = "+";
                        if ("+" == calculateType)
                        {
                            row[column] = list.Sum(c =>
                            {
                                decimal temp = StringHelper.DynamicToDecimal(c[column]);
                                return(temp);
                            }).ToString();
                        }
                        if ("/" == calculateType)
                        {
                            row[column] = list.Average(c =>
                            {
                                decimal temp = StringHelper.DynamicToDecimal(c[column]);
                                return(temp);
                            }).ToString();
                        }
                    });
                    resultTable.Rows.Add(row);
                });
            }

            return(resultTable);
        }
Пример #45
0
 public override ActionResult Add(RequestData data)
 {
     return(base.Add(data));
 }
Пример #46
0
 public override ActionResult Delete(RequestData data)
 {
     return(base.Delete(data));
 }
Пример #47
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            string Dids = Request.QueryString["Dids"];

            Logistic ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <Logistic>();
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent            = this.GetPostedData <Logistic>();
                ent.DeliveryId = Dids;
                ent.DoCreate();

                //修改物流状态
                Aim.Data.DataHelper.ExecSql("update " + db + "..DeliveryOrder set LogisticState='已填写' where Id in ('" + Dids.Replace(",", "','") + "')");

                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <Logistic>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;

            default:
                if (RequestActionString == "getchild")
                {
                    string number  = RequestData.Get <string>("number");
                    string strjson = RequestData.Get <string>("child").Replace("[]", "");
                    if (strjson.Length > 0)
                    {
                        strjson = strjson.Substring(1, strjson.Length - 2);
                    }
                    if (number != "")
                    {
                        DeliveryOrder order = DeliveryOrder.FindAllByProperty("Number", number).FirstOrDefault <DeliveryOrder>();
                        if (order != null)
                        {
                            if (strjson.Length != 0 && order.Child.Substring(1, order.Child.Length - 2) != "")
                            {
                                strjson += ",";
                            }
                            strjson += order.Child.Substring(1, order.Child.Length - 2);
                        }
                    }
                    if (strjson != "")
                    {
                        strjson = "[" + strjson + "]";
                        PageState.Add("result", strjson);
                    }
                }
                break;
            }

            if (op == "c" && !string.IsNullOrEmpty(Dids))
            {
                string[]        didarry = Dids.Split(',');
                DeliveryOrder[] dorders = DeliveryOrder.FindAllByPrimaryKeys(didarry);
                if (dorders.Length > 0)
                {
                    dorders[0].Id     = "";
                    dorders[0].Number = "";
                    dorders[0].Remark = "";
                    dorders[0].State  = "";

                    //string json = "";
                    //foreach (DeliveryOrder order in dorders)
                    //{
                    //    if (order != null && !string.IsNullOrEmpty(order.Child))
                    //    {
                    //        json += order.Child.Substring(1, order.Child.Length - 2) + ",";
                    //    }
                    //}
                    //dorders[0].Child = "[" + json.Substring(0, json.Length - 1) + "]";

                    this.SetFormData(dorders[0]);

                    IList <EasyDictionary> dicts = DataHelper.QueryDictList("select Id,PCode as Code,PName as [Name],Unit,[Count] as OutCount,Remark from " + db + "..DelieryOrderPart where DId in ('" + Dids.Replace(",", "','") + "')");
                    PageState.Add("DetailList", dicts);
                }
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = Logistic.Find(id);
                }

                this.SetFormData(ent);
            }

            PageState.Add("EDNames", SysEnumeration.GetEnumDict("EDNames"));
            PageState.Add("EDPayType", SysEnumeration.GetEnumDict("EDPayType"));
        }
Пример #48
0
 protected override bool DoEdit(RequestData data)
 {
     return(false);
 }
Пример #49
0
 public FakeHttpContext(HttpApplication application, HttpContext context, FakePrincipal principal, NameValueCollection formParams, NameValueCollection queryStringParams, HttpCookieCollection cookies, SessionStateItemCollection sessionItems, RequestData data, HttpBrowserCapabilitiesData dataCaps)
 {
     this.ApplicationInstance = application;
     this.Context             = context;
     _principal         = principal;
     _formParams        = formParams;
     _queryStringParams = queryStringParams;
     _cookies           = cookies;
     _sessionItems      = sessionItems;
     _data     = data;
     _dataCaps = dataCaps;
 }
Пример #50
0
        public ActionResult getChartInfo(RequestData data)
        {
            DataTable dtData = NewMethod(data);
            //var dtData = MonitorData.GetMonitorData("", DateTime.Parse(Request.QueryString["startTime"]), DateTime.Parse(Request.QueryString["endTime"]), "C", Request.QueryString["Companyid"], Request.QueryString["selectData"], "GasItem,WaterItem");


            StringBuilder x = new StringBuilder();
            List <KeyValuePair <string, string> > y = new List <KeyValuePair <string, string> >();
            StringBuilder y1  = new StringBuilder();
            StringBuilder y2  = new StringBuilder();
            StringBuilder y3  = new StringBuilder();
            StringBuilder y4  = new StringBuilder();
            StringBuilder y5  = new StringBuilder();
            StringBuilder y6  = new StringBuilder();
            StringBuilder y7  = new StringBuilder();
            StringBuilder y8  = new StringBuilder();
            StringBuilder y9  = new StringBuilder();
            StringBuilder y10 = new StringBuilder();

            foreach (DataRow row in dtData.Rows)
            {
                x.Append("'" + row["AREA_NAME"].ToString() + "',");


                y1.Append("'" + row["a34013_PFL_Value"].ToString() + "',");
                y2.Append("'" + row["a21026_PFL_Value"].ToString() + "',");
                y3.Append("'" + row["a21002_PFL_Value"].ToString() + "',");
                y4.Append("'" + row["flowgas_Value"].ToString() + "',");
                y5.Append("'" + row["a19001_Value"].ToString() + "',");

                y6.Append("'" + row["a01012_Value"].ToString() + "',");
                y7.Append("'" + row["a01013_Value"].ToString() + "',");
                y8.Append("'" + row["w01018_PFL_Value"].ToString() + "',");
                y9.Append("'" + row["w21003_PFL_Value"].ToString() + "',");
                y10.Append("'" + row["flowwater_Value"].ToString() + "',");
            }
            if (x.Length > 0)
            {
                x = x.Remove(x.Length - 1, 1);
            }
            if (y1.Length > 0)
            {
                y1 = y1.Remove(y1.Length - 1, 1);
            }
            if (y2.Length > 0)
            {
                y2 = y2.Remove(y2.Length - 1, 1);
            }
            if (y3.Length > 0)
            {
                y3 = y3.Remove(y3.Length - 1, 1);
            }
            if (y4.Length > 0)
            {
                y4 = y4.Remove(y4.Length - 1, 1);
            }
            if (y5.Length > 0)
            {
                y5 = y5.Remove(y5.Length - 1, 1);
            }
            if (y6.Length > 0)
            {
                y6 = y6.Remove(y6.Length - 1, 1);
            }
            if (y7.Length > 0)
            {
                y7 = y7.Remove(y7.Length - 1, 1);
            }
            if (y8.Length > 0)
            {
                y8 = y8.Remove(y8.Length - 1, 1);
            }
            if (y9.Length > 0)
            {
                y9 = y9.Remove(y9.Length - 1, 1);
            }
            if (y10.Length > 0)
            {
                y10 = y10.Remove(y10.Length - 1, 1);
            }
            y.Add(new KeyValuePair <string, string>("烟尘", y1.ToString()));
            y.Add(new KeyValuePair <string, string>("二氧化硫", y2.ToString()));
            y.Add(new KeyValuePair <string, string>("氮氧化物", y3.ToString()));
            y.Add(new KeyValuePair <string, string>("废气流量", y4.ToString()));
            y.Add(new KeyValuePair <string, string>("含氧量", y5.ToString()));
            y.Add(new KeyValuePair <string, string>("烟气温度", y6.ToString()));
            y.Add(new KeyValuePair <string, string>("烟气压力", y7.ToString()));
            y.Add(new KeyValuePair <string, string>("化学需氧量", y8.ToString()));
            y.Add(new KeyValuePair <string, string>("氨氮", y9.ToString()));
            y.Add(new KeyValuePair <string, string>("废水流量", y10.ToString()));



            return(Json(EChartsHelper.GetBaseChart(x.ToString(), y, "", "厘米", "'烟尘','二氧化硫','氮氧化物','废气流量','含氧量','烟气温度','烟气压力','化学需氧量','氨氮','废水流量'", " ", "bar", false, false)));
        }
Пример #51
0
        //
        // GET: /Bas/SmsTemplate/

        protected override SqlModel GetSqlModel(RequestData data)
        {
            FieldModel where = null;
            string SMSTEMPTYPE = data.Get("TEMPTYPE").Trim();

            if (SMSTEMPTYPE != "")
            {
                where &= SMSTEMPLATE.SMSTEMPTYPE == SMSTEMPTYPE;
            }

            DateTime dtNow   = DateTime.Now;
            DateTime tmStart = new DateTime(dtNow.Year, dtNow.Month, 1);
            DateTime tmEnd   = dtNow.Date;

            if (!string.IsNullOrEmpty(data.Get("opBegDate")))
            {
                DateTime.TryParse(data.Get("opBegDate"), out tmStart);
            }
            if (!string.IsNullOrEmpty(data.Get("opEndDate")))
            {
                DateTime.TryParse(data.Get("opEndDate"), out tmEnd);
            }

            tmEnd  = tmEnd.AddHours(23).AddMinutes(59).AddSeconds(59);
            where &= SMSLOG.SENDTIME.BetweenAnd(tmStart, tmEnd);

            SqlModel sqlmode = SqlModel.SelectAll(
                BASDIC.TITLE.As("SMSTEMPTYPE_TEXT"),
                "u".Field(BASUSER.TRUENAME).ListAgg("u".Field(BASUSER.TRUENAME).ToChar(), ',').As("USERNAME_TEXT")
                )
                               .From(DB.SMSLOG)
                               .LeftJoin(DB.BASDIC).On(SMSLOG.SMSTEMPTYPE == BASDIC.CODE & BASDIC.TYPECODE == "SMSTEMPTYPE")
                               .LeftJoin(DB.BASUSER.As("u")).On(SMSLOG.RECEIVEUSER.Instr("u".Field(BASUSER.MOBILE).ToChar(), ','))
                               .Where(where).OrderByDesc(SMSLOG.SENDTIME)
                               .GroupBy(
                SMSLOG.ID,
                SMSLOG.CONTENT,
                SMSLOG.STATUS,
                SMSLOG.SENDTIME,
                SMSLOG.RECEIVEUSER,
                SMSLOG.SMSTEMPTYPE,
                SMSLOG.SMSBASTYPE,
                BASDIC.TITLE,
                "u".Field(BASUSER.TRUENAME)
                );

            if (!string.IsNullOrEmpty(data.Get("USERNAME_TEXT")))
            {
                FieldModel field = new FieldModel();
                field.Name      = "SEND_PERSON_TEXT";
                field.TableName = "t";

                sqlmode = SqlModel.Select(new FieldModel[] {
                    new FieldModel()
                    {
                        Name = SMSLOG.ID.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = SMSLOG.CONTENT.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = SMSLOG.STATUS.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = SMSLOG.SENDTIME.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = SMSLOG.RECEIVEUSER.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = SMSLOG.SMSTEMPTYPE.Name, TableName = "t"
                    },
                    new FieldModel()
                    {
                        Name = "USERNAME_TEXT", TableName = "t"
                    }
                }).From(sqlmode.As("t")).Where(field.Like(data.Get("USERNAME_TEXT")));
            }

            return(sqlmode);
        }
        /// <summary>
        /// 删除家属信息
        /// </summary>
        private void DelFamilyMember()
        {
            string sql = "delete  FL_Culture..UsrTravelInfo where ID in(" + RequestData.Get <string>("idList") + ")";

            DataHelper.ExecSql(sql);
        }
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            SysParameterCatalog ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <SysParameterCatalog>();
                ent.Update();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Create:
                ent             = this.GetPostedData <SysParameterCatalog>();
                ent.CreaterID   = UserInfo.UserID;
                ent.CreaterName = UserInfo.Name;

                if (String.IsNullOrEmpty(id))
                {
                    ent.CreateAsRoot();
                }
                else
                {
                    ent.CreateAsSibling(SysParameterCatalog.Find(id));
                }

                this.SetMessage("新建成功!");
                break;

            default:
                if (RequestActionString == "createsub")
                {
                    ent             = this.GetPostedData <SysParameterCatalog>();
                    ent.CreaterID   = UserInfo.UserID;
                    ent.CreaterName = UserInfo.Name;

                    ent.CreateAsChild(SysParameterCatalog.Find(id));

                    this.SetMessage("新建成功!");
                }
                break;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = SysParameterCatalog.Find(id);
                }

                this.SetFormData(ent);
            }
            else
            {
                PageState.Add("CreaterName", UserInfo.Name);
                PageState.Add("CreatedDate", DateTime.Now);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            op = RequestData.Get <string>("op");
            string link = RequestData.Get <string>("link");

            typeId = RequestData.Get <string>("TypeId", String.Empty);

            ImgNews ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Delete:
                ent = this.GetTargetData <ImgNews>();
                ent.Delete();
                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Custom:
                if (this.RequestActionString.ToLower() == "submitnews")
                {
                    ImgNews ne = ImgNews.Find(this.RequestData["Id"].ToString());
                    ne.State = this.RequestData["state"].ToString();
                    ne.Save();
                    if (this.RequestData["state"].ToString() == "1")
                    {
                        PageState.Add("message", "提交成功");
                    }
                    else
                    {
                        PageState.Add("message", "收回成功");
                    }
                    return;
                }
                else if (RequestActionString == "batchdelete")
                {
                    DoBatchDelete();
                }
                break;

            default:
                if (link == "home")
                {
                    string path = DataHelper.QueryValue("select g.Path from SysGroup g inner join sysusergroup ug on ug.GroupId=g.GroupId where UserId='" + UserInfo.UserID + "'") + "";
                    string sql  = @"select n.* from ImgNews n 
                                    inner join NewsType nt on nt.Id=n.TypeId
                                    where TypeId='{2}' 
                                    and State='2' and isnull(ExpireTime,'2099-01-01')>=getdate()
                                    and (charindex('{0}',n.CreateId)>0 or charindex('{0}',n.ReceiveUserId)>0 or charindex('{0}',nt.AllowQueryId)>0 or 
                                    exists (select Id from Competence c where c.Ext1=n.Id and charindex(PId,'{1}')>0)
                                    or exists (select Id from Competence c where c.Ext1=nt.Id and charindex(PId,'{1}')>0))";
                    sql = string.Format(sql, UserInfo.UserID, path, typeId);
                    PageState.Add("DataList", GetPageData(sql, SearchCriterion));
                }
                else
                {
                    string where = " and isnull(ExpireTime,'2099-01-01')>=getdate() ";
                    if (RequestData.Get <string>("Expire") == "true")
                    {
                        where = " and isnull(ExpireTime,'2099-01-01')<getdate() ";
                    }
                    foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
                    {
                        if (!String.IsNullOrEmpty(item.Value.ToString()))
                        {
                            switch (item.PropertyName)
                            {
                            default:
                                where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                                break;
                            }
                        }
                    }
                    SearchCriterion.SetSearch("TypeId", typeId);
                    ents = ImgNews.FindAll(SearchCriterion, Expression.Sql(" CreateId = '" + UserInfo.UserID + "' " + where)).OrderByDescending(o => o.CreateTime).ToArray();

                    this.PageState.Add("DataList", ents);
                }
                break;
            }

            if (!IsAsyncRequest)
            {
                NewsType[] types = NewsType.FindAll();
                Dictionary <string, string> dt = new Dictionary <string, string>();

                foreach (NewsType type in types)
                {
                    dt.Add(type.Id, type.TypeName);
                }

                this.PageState.Add("EnumType", dt);
            }
        }
Пример #55
0
        public void AddLengthClasses(IEnumerable <ValidationAttribute> propertyValidators, HtmlTag htmlTag, RequestData requestData)
        {
            var lengthValidator = propertyValidators.OfType <StringLengthAttribute>().FirstOrDefault();

            if (lengthValidator != null)
            {
                htmlTag.Attr("maxlength", lengthValidator.MaximumLength);
            }
        }
        string type = String.Empty; // 对象类型
        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            A_TaskWBS ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <A_TaskWBS>();
                if (this.RequestData.Get <string>("issubmit", "") != "")
                {
                    ent.State          = "1";
                    ent.SubmitDate     = DateTime.Now;
                    ent.SubmitUserId   = this.UserInfo.UserID;
                    ent.SubmitUserName = this.UserInfo.Name;
                }
                ent.Update();
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent            = this.GetPostedData <A_TaskWBS>();
                ent.CreateId   = this.UserInfo.UserID;
                ent.CreateName = this.UserInfo.Name;
                ent.CreateTime = DateTime.Now;
                if (this.RequestData.Get <string>("issubmit", "") != "")
                {
                    ent.State = "1";
                }
                if (ent.TaskType == null)
                {
                    ent.TaskType = "任务";
                }
                if (String.IsNullOrEmpty(id))
                {
                    ent.CreateAsRoot();
                }
                else
                {
                    ent.State = "0";
                    if (this.RequestData.Get <string>("issubmit", "") != "")
                    {
                        ent.State = "1";
                    }
                    ent.CreateAsSibling(id);
                }
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <A_TaskWBS>();
                ent.Delete();
                return;

            default:
                if (RequestActionString == "createsub")
                {
                    ent       = this.GetPostedData <A_TaskWBS>();
                    ent.State = "0";
                    if (this.RequestData.Get <string>("issubmit", "") != "")
                    {
                        ent.State          = "1";
                        ent.SubmitDate     = DateTime.Now;
                        ent.SubmitUserId   = this.UserInfo.UserID;
                        ent.SubmitUserName = this.UserInfo.Name;
                    }
                    ent.TaskType   = this.RequestData.Get <string>("TaskType");
                    ent.CreateId   = this.UserInfo.UserID;
                    ent.CreateName = this.UserInfo.Name;
                    ent.CreateTime = DateTime.Now;
                    ent.Year       = DateTime.Now.Year.ToString();
                    ent.CreateAsChild(id);
                    this.SetMessage("新建成功!");
                }
                else if (RequestActionString == "submitfinish")
                {
                    if (this.RequestData.Get <string>("id") != null)
                    {
                        ent             = A_TaskWBS.Find(id);
                        ent.State       = "2";
                        ent.FactEndDate = DateTime.Now;
                        ent.Save();
                    }
                }
                else if (RequestActionString == "GetNextUsers")
                {
                    ent = A_TaskWBS.Find(id);
                    A_TaskWBS ptEnt = A_TaskWBS.TryFind(ent.ParentID);
                    PageState.Add("NextUsers", new string[] { ptEnt.DutyId, ptEnt.DutyName });
                }
                break;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = A_TaskWBS.Find(id);
                    if (ent.Parent != null)
                    {
                        this.PageState.Add("ParentNode", ent.Parent);
                    }
                    string sql = @"select * from Task where PatIndex('%{0}%',EFormName)>0  and Status='4' and Ext1 is null order by FinishTime asc";
                    sql = string.Format(sql, ent.Id);
                    IList <EasyDictionary> taskDics = DataHelper.QueryDictList(sql);
                    PageState.Add("Opinion", taskDics);
                    try
                    {
                        string    sqlUsers = "select UserID,UserName from dbo.View_SysUserGroup where ParentId='" + ent.DeptId + "' and ChildDeptName='所(处、部)长'";
                        DataTable dt       = DataHelper.QueryDataTable(sqlUsers);
                        if (dt.Rows.Count > 0)
                        {
                            this.PageState.Add("DeptLeaderUserId", dt.Rows[0]["UserID"].ToString());
                            this.PageState.Add("DeptLeaderUserName", dt.Rows[0]["UserName"].ToString());
                        }
                    }
                    catch { }
                }

                this.SetFormData(ent);
            }
            else if (op == "cs")
            {
                if (this.RequestData.Get <string>("id") != null)
                {
                    ent = A_TaskWBS.Find(id);
                    A_TaskWBS nt = new A_TaskWBS();
                    //加上默认的序号等数据
                    nt.Code            = ent.Code + "-" + (A_TaskWBS.FindAllByProperties(A_TaskWBS.Prop_ParentID, id).Length + 1).ToString();
                    nt.LeaderName      = ent.LeaderName;
                    nt.LeaderId        = ent.LeaderId;
                    nt.DeptId          = ent.DeptId;
                    nt.DeptName        = ent.DeptName;
                    nt.PlanEndDate     = ent.PlanEndDate;
                    nt.SecondDeptIds   = ent.SecondDeptIds;
                    nt.SecondDeptNames = ent.SecondDeptNames;
                    this.SetFormData(nt);
                }
            }
            string taskId = RequestData.Get <string>("TaskId");

            if (!string.IsNullOrEmpty(taskId))
            {
                Task tEnt = Task.Find(taskId);
                if (tEnt.Status != 4 && !string.IsNullOrEmpty(tEnt.Description))
                {
                    PageState.Add("UnSubmitOpinion", tEnt.Description);
                }
            }
        }
Пример #57
0
        public void AddRegexData(IEnumerable <ValidationAttribute> propertyValidators, HtmlTag htmlTag, RequestData request)
        {
            var regex = propertyValidators.OfType <RegularExpressionAttribute>().FirstOrDefault();

            if (regex != null)
            {
                var msg = regex.ErrorMessage ?? string.Format("The field '{0}' did not match the regular expression '{1}'", request.Accessor.InnerProperty.Name, regex.Pattern);
                if (_msUnobtrusive)
                {
                    htmlTag.Data("val", true).Data("val-regex", msg).Data("val-regex-pattern", regex.Pattern);
                }
                else
                {
                    htmlTag.Data("rule-regex", regex.Pattern).Data("msg-regex", msg);
                }
            }
        }
Пример #58
0
        string code = String.Empty; // 编码

        #endregion

        #region 构造函数

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            code = RequestData.Get <string>("code");

            switch (RequestAction)
            {
            case RequestActionEnum.Default:
            case RequestActionEnum.Read:
            case RequestActionEnum.Query:
                DoSelect();
                break;

            case RequestActionEnum.Custom:
                if (RequestActionString == "getpermission")
                {
                    DynamicPermission[] dps = null;
                    if (type == "user")
                    {
                        dps = DynamicPermission.GetOrgPermissions(id, DynamicPermissionCatalog.SysCatalogEnum.SYS_USER);
                    }
                    else if (type == "role")
                    {
                        dps = DynamicPermission.GetOrgPermissions(id, DynamicPermissionCatalog.SysCatalogEnum.SYS_ROLE);
                    }
                    else if (type == "group")
                    {
                        dps = DynamicPermission.GetOrgPermissions(id, DynamicPermissionCatalog.SysCatalogEnum.SYS_GROUP);
                    }
                    else
                    {
                        dps = DynamicPermission.GetPermissionsByCatalogCode(id, type);
                    }

                    PageState.Add("DPList", dps);
                }
                break;

            case RequestActionEnum.Update:
                IList <string> pids = RequestData.GetList <string>("pidList");      // 权限标识
                IList <string> aids = RequestData.GetList <string>("aidList");      // 授权标识
                IList <string> ops  = RequestData.GetList <string>("opList");       // 操作标识

                string pcatalog = RequestData.Get <string>("pcatalog");
                string tag      = RequestData.Get <string>("tag");

                for (int i = 0; i < pids.Count; i++)
                {
                    var tpid = (pids[i] == null ? pids[i] : pids[i].Trim());
                    var taid = (aids[i] == null ? aids[i] : aids[i].Trim());
                    var top  = (ops[i] == null ? ops[i] : ops[i].Trim());

                    if (!String.IsNullOrEmpty(tpid))
                    {
                        DynamicPermission dp = DynamicPermission.Find(tpid);
                        if (!String.IsNullOrEmpty(top))
                        {
                            dp.Operation = top;
                            dp.DoUpdate();
                        }
                        else
                        {
                            dp.DoDelete();
                        }
                    }
                    else
                    {
                        if (!String.IsNullOrEmpty(taid) && !String.IsNullOrEmpty(top))
                        {
                            DynamicAuth    tauth   = DynamicAuth.Find(taid);
                            IList <string> tOpList = top.Split(DynamicOperations.DivChar);

                            if (type == "user")
                            {
                                DynamicPermission.GrantDAuthToUser(tauth, id, tOpList, null, UserInfo.UserID, UserInfo.Name);
                            }
                            else if (type == "role")
                            {
                                DynamicPermission.GrantDAuthToRole(tauth, id, tOpList, null, UserInfo.UserID, UserInfo.Name);
                            }
                            else if (type == "group")
                            {
                                DynamicPermission.GrantDAuthToGroup(tauth, id, tOpList, null, UserInfo.UserID, UserInfo.Name);
                            }
                            else
                            {
                                DynamicPermission.GrantDAuths(new DynamicAuth[] { tauth }, new string[] { id }, tOpList, pcatalog, tag, UserInfo.UserID, UserInfo.Name);
                            }
                        }
                    }
                }

                break;
            }
        }
Пример #59
0
 public void Clear()
 {
     gameObject.SetActive(false);
     Destroy(_clientView);
     _requestData = null;
 }
		private string BuildOAuthHeader(RequestData requestData, string fullUrl, IDictionary<string, string> parameters, RequestPayload requestBody)
		{
			var httpMethod = requestData.HttpMethod.ToString().ToUpperInvariant();

			var oauthRequest = new OAuthRequest
				{
					Type = OAuthRequestType.ProtectedResource,
					RequestUrl = fullUrl,
					Method = httpMethod,
					ConsumerKey = _oAuthCredentials.ConsumerKey,
					ConsumerSecret = _oAuthCredentials.ConsumerSecret,
				};

			if (!string.IsNullOrEmpty(requestData.OAuthToken))
			{
				oauthRequest.Token = requestData.OAuthToken;
				oauthRequest.TokenSecret = requestData.OAuthTokenSecret;
			}

			if (ShouldReadParamsFromBody(parameters, requestBody))
			{
				var bodyParams = HttpUtility.ParseQueryString(requestBody.Data);
				var keys = bodyParams.AllKeys.Where(x => !string.IsNullOrEmpty(x));
				foreach (var key in keys)
				{
					parameters.Add(key, bodyParams[key]);
				}
			}

			return oauthRequest.GetAuthorizationHeader(parameters);
		}