Пример #1
0
        public virtual JObject GetHistoryTasks(HttpContext context)
        {
            YZRequest request = new YZRequest(context);

            GridPageInfo    gridPageInfo = new GridPageInfo(context);
            HistoryTaskType taskType     = request.GetEnum <HistoryTaskType>("HistoryTaskType", HistoryTaskType.AllAccessable);
            string          strTaskType  = request.GetString("HistoryTaskType");
            int             year         = request.GetString("byYear", "1") == "0" ? -1 : request.GetInt32("Year");

            //获得数据
            JObject rv = new JObject();

            string taskTableFilter;
            string stepTableFilter;

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                taskTableFilter = this.GetFilterStringHistoryTaskTaskTable(request, provider);
                stepTableFilter = this.GetFilterStringHistoryTaskStep(request, provider);
            }

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                int rowcount;
                BPMTaskCollection tasks = cn.GetHistoryTasks(year, taskType, taskTableFilter, stepTableFilter, request.GetSortString("TaskID DESC", null, "TaskID DESC"), gridPageInfo.Start, gridPageInfo.Limit, out rowcount);

                rv[YZJsonProperty.total] = rowcount;
                JArray children = new JArray();
                rv[YZJsonProperty.children] = children;

                foreach (BPMTask task in tasks)
                {
                    JObject item = new JObject();
                    children.Add(item);

                    item["TaskID"]           = task.TaskID;
                    item["SerialNum"]        = task.SerialNum;
                    item["ProcessName"]      = task.ProcessName;
                    item["ProcessVersion"]   = task.ProcessVersion.ToString(2);
                    item["OwnerAccount"]     = task.OwnerAccount;
                    item["OwnerDisplayName"] = task.OwnerFullName;
                    item["AgentAccount"]     = task.AgentAccount;
                    item["AgentDisplayName"] = task.AgentFullName;
                    item["CreateAt"]         = task.CreateAt;
                    item["State"]            = YZJsonHelper.GetTaskStateJObject(cn, task.TaskState, task.TaskID);
                    item["Description"]      = String.IsNullOrEmpty(task.Description) ? Resources.YZStrings.All_None : task.Description;
                }
            }

            return(rv);
        }
Пример #2
0
        public void ProcessRequest(HttpContext context)
        {
            YZAuthHelper.OAuth();

            //YZAuthHelper.AshxAuthCheck();

            GridPageInfo gridPageInfo = new GridPageInfo(context);
            IDBProvider  dbProvider   = YZDBProviderManager.CurrentProvider;

            int year;

            if (context.Request.Params["byYear"] == "0")
            {
                year = -1;
            }
            else
            {
                string strYear = context.Request.Params["Year"];
                year = String.IsNullOrEmpty(strYear) ? DateTime.Today.Year : Convert.ToInt32(strYear);
            }

            //获得数据
            BPMTaskCollection tasks = new BPMTaskCollection();
            int      rowcount;
            JsonItem rootItem = new JsonItem();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                tasks = cn.GetHistoryTasks(year, HistoryTaskType.AllAccessable, dbProvider.FilterStringHistoryTaskTaskTableFilter, dbProvider.FilterStringHistoryTaskStepTableFilter, null, gridPageInfo.Start, gridPageInfo.Limit, out rowcount);

                //将数据转化为Json集合
                rootItem.Attributes.Add(JsonItem.TotalRows, rowcount);

                JsonItemCollection children = new JsonItemCollection();
                rootItem.Attributes.Add("children", children);
                rootItem.Attributes.Add("total", rowcount);

                foreach (BPMTask task in tasks)
                {
                    JsonItem item = new JsonItem();
                    children.Add(item);

                    item.Attributes.Add("tid", task.TaskID);
                    item.Attributes.Add("pid", task.ParentStepID);
                    item.Attributes.Add("sn", task.SerialNum);
                    item.Attributes.Add("pn", task.ProcessName);
                    item.Attributes.Add("user", YZStringHelper.GetUserShortName(task.OwnerAccount, task.OwnerDisplayName));
                    item.Attributes.Add("state", task.TaskState.ToString());
                    item.Attributes.Add("stateText", YZStringHelper.GetTaskStateDisplayName(task.TaskState));
                    item.Attributes.Add("stateProcessing", YZStringHelper.GetTaskProcessingStatus(cn, task.TaskState, task.TaskID));
                    item.Attributes.Add("date", YZStringHelper.DateToStringL(task.CreateAt));


                    task.Description = task.ShowDescByProcessName(true);

                    item.Attributes.Add("desc", String.IsNullOrEmpty(task.Description) ? "无内容摘要" : task.Description);
                }
            }

            //System.Threading.Thread.Sleep(500);
            context.Response.AppendHeader("Access-Control-Allow-Origin", "*");      // 响应类型
            context.Response.AppendHeader("Access-Control-Allow-Methods", "POST");  // 响应头设置
            context.Response.AppendHeader("Access-Control-Allow-Headers", "x-requested-with,content-type");

            context.Response.Charset         = "gb2312"; //设置字符集类型
            context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
            context.Response.ContentType     = "application/json;charset=gb2312";
            //输出数据
            context.Response.Write(rootItem.ToString());
        }
Пример #3
0
        public virtual JObject GetHistoryTasks(HttpContext context)
        {
            YZRequest       request  = new YZRequest(context);
            HistoryTaskType taskType = request.GetEnum <HistoryTaskType>("HistoryTaskType", HistoryTaskType.AllAccessable);
            int             year     = request.GetString("byYear", "1") == "0" ? -1 : request.GetInt32("Year", DateTime.Today.Year);

            //获得数据
            JObject rv = new JObject();

            string taskTableFilter;
            string stepTableFilter;

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                taskTableFilter = this.GetFilterStringHistoryTaskTaskTable(request, provider);
                stepTableFilter = this.GetFilterStringHistoryTaskStep(request, provider);
            }

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                int rowcount;
                BPMTaskCollection tasks = cn.GetHistoryTasks(year, taskType, taskTableFilter, stepTableFilter, null, request.Start, request.Limit, out rowcount);

                rv[YZJsonProperty.total] = rowcount;
                JArray children = new JArray();
                rv[YZJsonProperty.children] = children;

                foreach (BPMTask task in tasks)
                {
                    JObject item = new JObject();
                    children.Add(item);

                    item["TaskID"]           = task.TaskID;
                    item["SerialNum"]        = task.SerialNum;
                    item["ProcessName"]      = task.ProcessName;
                    item["ProcessVersion"]   = task.ProcessVersion.ToString(2);
                    item["OwnerAccount"]     = task.OwnerAccount;
                    item["OwnerDisplayName"] = task.OwnerDisplayName;
                    item["AgentAccount"]     = task.AgentAccount;
                    item["AgentDisplayName"] = task.AgentDisplayName;
                    item["CreateAt"]         = task.CreateAt;
                    item["State"]            = YZJsonHelper.GetTaskStateJObject(cn, task.TaskState, task.TaskID);
                    item["Description"]      = task.Description;

                    try
                    {
                        ProcessProperty property = BPMProcess.GetProcessProperty(cn, task.ProcessName, task.ProcessVersion);
                        item["ShortName"] = property.ShortName;
                        item["Color"]     = property.Color;

                        if (String.IsNullOrEmpty(property.ShortName))
                        {
                            item["ShortName"] = YZStringHelper.GetProcessDefaultShortName(task.ProcessName);
                        }
                    }
                    catch (Exception)
                    {
                        item["Color"]     = this._deletedProcessColor;
                        item["ShortName"] = YZStringHelper.GetProcessDefaultShortName(task.ProcessName);
                    }
                }
            }

            return(rv);
        }
Пример #4
0
        public void ProcessRequest(HttpContext context)
        {
            YZAuthHelper.OAuth();

            //YZAuthHelper.AshxAuthCheck();

            //GridPageInfo gridPageInfo = new GridPageInfo(context);
            //IDBProvider dbProvider = YZDBProviderManager.CurrentProvider;

            int Mouth;

            if (context.Request.Params["byMouth"] == "1")
            {
                Mouth = 0;
            }
            else
            {
                string strMouth = context.Request.Params["Mouth"];
                Mouth = String.IsNullOrEmpty(strMouth) ? DateTime.Today.Month : Convert.ToInt32(strMouth);
            }

            //获得数据
            BPMTaskCollection tasks = new BPMTaskCollection();
            int      rowcount       = 0;
            JsonItem rootItem       = new JsonItem();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                String UserAccount = context.Request.Params["UserAccount"];

                //User user = User.FromAccount(cn, UserID);

                //YZAuthHelper.SetAuthCookie(realAccount);
                //YZAuthHelper.GetCookie();

                DataTable Dt = new SqlServerProvider(context).getWorkTimesLog(UserAccount, Mouth);

                //将数据转化为Json集合
                rootItem.Attributes.Add(JsonItem.TotalRows, rowcount);

                JsonItemCollection children = new JsonItemCollection();
                rootItem.Attributes.Add("children", children);
                rootItem.Attributes.Add("total", Dt.Rows.Count);

                int index = 0;
                foreach (DataRow Dr in Dt.Rows)
                {
                    JsonItem item = new JsonItem();
                    children.Add(item);


                    String StartTime = String.IsNullOrEmpty(Convert.ToString(Dr["StartTime"])) ? null : Convert.ToString(Dr["StartTime"]);
                    String EndTime   = String.IsNullOrEmpty(Convert.ToString(Dr["EndTime"])) ? null : Convert.ToString(Dr["EndTime"]);


                    item.Attributes.Add("ID", index);
                    item.Attributes.Add("EmpID", Dr["EmpID"].ToString());
                    item.Attributes.Add("WorkDay", Dr["WorkDay"].ToString());
                    item.Attributes.Add("WeekInt", Dr["WeekInt"].ToString());
                    item.Attributes.Add("ClassID", Dr["ClassID"].ToString());
                    item.Attributes.Add("StartTime", YZStringHelper.DateToStringL(Convert.ToDateTime(StartTime)));
                    item.Attributes.Add("EndTime", YZStringHelper.DateToStringL(Convert.ToDateTime(EndTime)));
                    item.Attributes.Add("NotCard", Convert.ToString(Dr["NotCard"]));
                    item.Attributes.Add("GongGan", Convert.ToString(Dr["GongGan"]));

                    item.Attributes.Add("V1", Convert.ToString(Dr["V1"]));
                    item.Attributes.Add("V2", Convert.ToString(Dr["V2"]));
                    item.Attributes.Add("V3", Convert.ToString(Dr["V3"]));
                    item.Attributes.Add("V4", Convert.ToString(Dr["V4"]));
                    item.Attributes.Add("V5", Convert.ToString(Dr["V5"]));
                    item.Attributes.Add("V6", Convert.ToString(Dr["V6"]));

                    item.Attributes.Add("HDay", Convert.ToString(Dr["HDay"]).Split(',')[0].Replace(" ", ""));
                    item.Attributes.Add("Holiday", Convert.ToString(Dr["Holiday"]));

                    item.Attributes.Add("OverTime_H", Convert.ToString(Dr["OverTime_H"]));
                    item.Attributes.Add("OverTime_W", Convert.ToString(Dr["OverTime_W"]));
                    item.Attributes.Add("OverTime", Convert.ToString(Dr["OverTime"]));



                    //item.Attributes.Add("UserShortName", YZStringHelper.GetUserShortName(task.OwnerAccount, task.OwnerDisplayName));

                    index++;
                }
            }

            //System.Threading.Thread.Sleep(500);
            context.Response.AppendHeader("Access-Control-Allow-Origin", "*");      // 响应类型
            context.Response.AppendHeader("Access-Control-Allow-Methods", "POST");  // 响应头设置
            context.Response.AppendHeader("Access-Control-Allow-Headers", "x-requested-with,content-type");

            context.Response.Charset         = "gb2312"; //设置字符集类型
            context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
            context.Response.ContentType     = "application/json;charset=gb2312";
            //输出数据
            context.Response.Write(rootItem.ToString());
        }
Пример #5
0
        public void ProcessRequest(HttpContext context)
        {
            YZAuthHelper.OAuth();

            //YZAuthHelper.AshxAuthCheck();

            //GridPageInfo gridPageInfo = new GridPageInfo(context);
            //IDBProvider dbProvider = YZDBProviderManager.CurrentProvider;

            int rowcount = 0;

            //获得数据
            BPMTaskCollection tasks = new BPMTaskCollection();

            JsonItem rootItem = new JsonItem();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                String UserID = context.Request.Params["UserID"];
                String Phone  = context.Request.Params["Phone"];

                //User user = User.FromAccount(cn, UserID);
                //YZAuthHelper.SetAuthCookie(realAccount);
                //YZAuthHelper.GetCookie();

                //将数据转化为Json集合
                rootItem.Attributes.Add(JsonItem.TotalRows, rowcount);

                JsonItemCollection children = new JsonItemCollection();
                rootItem.Attributes.Add("children", children);

                int index = 0;

                if (Phone == null)
                {
                    DataTable Dt = new SqlServerProvider(context).getUserLogInfo(UserID);
                    rootItem.Attributes.Add("total", Dt.Rows.Count);


                    foreach (DataRow Dr in Dt.Rows)
                    {
                        JsonItem item = new JsonItem();
                        children.Add(item);

                        item.Attributes.Add("ID", index);
                        item.Attributes.Add("UserAccount", Dr["UserAccount"].ToString());
                        item.Attributes.Add("DisplayName", Dr["DisplayName"].ToString());
                        item.Attributes.Add("Company", Dr["Company"].ToString());
                        item.Attributes.Add("Department", Dr["Department"].ToString());

                        item.Attributes.Add("Counts", Convert.ToString(Dr["Counts"]));
                        item.Attributes.Add("Phone", Convert.ToString(Dr["Phone"]));

                        index++;
                    }
                }
                else
                {
                    DataTable Dt = new SqlServerProvider(context).getUserLogInfoDtl(UserID, Phone);
                    rootItem.Attributes.Add("total", Dt.Rows.Count);

                    foreach (DataRow Dr in Dt.Rows)
                    {
                        JsonItem item = new JsonItem();
                        children.Add(item);

                        item.Attributes.Add("ID", index);
                        item.Attributes.Add("UserAccount", Dr["UserAccount"].ToString());
                        item.Attributes.Add("DisplayName", Dr["DisplayName"].ToString());
                        item.Attributes.Add("Company", Dr["Company"].ToString());
                        item.Attributes.Add("Department", Dr["Department"].ToString());

                        item.Attributes.Add("UserEMail", Convert.ToString(Dr["UserEMail"]));

                        item.Attributes.Add("LogDate", Convert.ToString(Dr["LogDate"]));
                        item.Attributes.Add("Phone", Convert.ToString(Dr["Phone"]));
                        item.Attributes.Add("UUID", Convert.ToString(Dr["UUID"]));
                        item.Attributes.Add("DeviceName", Convert.ToString(Dr["DeviceName"]));
                        item.Attributes.Add("NetWork", Convert.ToString(Dr["NetWork"]));
                        item.Attributes.Add("Version", Convert.ToString(Dr["Version"]));

                        item.Attributes.Add("ClientIP", Convert.ToString(Dr["ClientIP"]));
                        item.Attributes.Add("FullName", Convert.ToString(Dr["FullName"]));

                        index++;
                    }
                }
            }


            context.Response.Write(rootItem.ToString());
        }