예제 #1
0
파일: User.cs 프로젝트: radtek/EMIP
        public virtual void SetOutOfOffice(HttpContext context)
        {
            YZRequest request = new YZRequest(context);

            OutOfOfficeState state    = request.GetEnum <OutOfOfficeState>("state");
            DateTime         dateFrom = request.GetDateTime("DateFrom", DateTime.MinValue);
            DateTime         dateTo   = request.GetDateTime("DateTo", DateTime.MinValue);
            string           uid      = YZAuthHelper.LoginUserAccount;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                User.SetOutOfOffice(cn, uid, state, dateFrom, dateTo);
            }
        }
예제 #2
0
        public virtual void SaveLeavingSetting(HttpContext context)
        {
            string    account = YZAuthHelper.LoginUserAccount;
            YZRequest request = new YZRequest(context);

            OutOfOfficeState state = request.GetEnum <OutOfOfficeState>("State");
            DateTime         from  = request.GetDateTime("From", DateTime.MinValue);
            DateTime         to    = request.GetDateTime("To", DateTime.MinValue);

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                User.SetOutOfOffice(cn, account, state, from, to);
            }
        }
예제 #3
0
파일: DailyReport.cs 프로젝트: radtek/EMIP
        public virtual object GetTeamReports(HttpContext context)
        {
            YZRequest request   = new YZRequest(context);
            string    myaccount = request.GetString("account", YZAuthHelper.LoginUserAccount);
            DateTime  date      = request.GetDateTime("date");

            BPMObjectNameCollection accounts = new BPMObjectNameCollection();

            accounts.Add(myaccount);

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

                MemberCollection positions = OrgSvr.GetUserPositions(bpmcn, myaccount);
                foreach (Member position in positions)
                {
                    DirectXSCollection xss = position.GetDirectXSs(bpmcn);
                    foreach (DirectXS xs in xss)
                    {
                        if (!accounts.Contains(xs.UserAccount))
                        {
                            accounts.Add(xs.UserAccount);
                        }
                    }
                }

                DailyReportCollection rv = new DailyReportCollection();
                foreach (string account in accounts)
                {
                    DailyReport dailyReport;

                    using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
                    {
                        using (IDbConnection cn = provider.OpenConnection())
                        {
                            dailyReport = DailyReportManager.TryGetReport(provider, cn, account, date);

                            if (dailyReport == null)
                            {
                                dailyReport         = new DailyReport();
                                dailyReport.Account = account;
                                dailyReport.Date    = date;
                            }

                            rv.Add(dailyReport);
                        }
                    }

                    User user = User.TryGetUser(bpmcn, account);
                    dailyReport["ShortName"] = user == null ? "" : user.ShortName;
                }

                return(rv);
            }
        }
예제 #4
0
파일: Footmark.cs 프로젝트: radtek/EMIP
        public virtual object GetUserList(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            string    account = request.GetString("account", YZAuthHelper.LoginUserAccount);
            DateTime  month   = request.GetDateTime("month");

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    return(FootmarkManager.GetFootmarks(provider, cn, account, month.Year, month.Month, null, null, request.Start, request.Limit));
                }
            }
        }
예제 #5
0
파일: DailyReport.cs 프로젝트: radtek/EMIP
        public virtual object TryGetReport(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            string    account = request.GetString("account", YZAuthHelper.LoginUserAccount);
            DateTime  date    = request.GetDateTime("date");

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    return(new
                    {
                        report = DailyReportManager.TryGetReport(provider, cn, account, date)
                    });
                }
            }
        }
예제 #6
0
파일: DailyReport.cs 프로젝트: radtek/EMIP
        public virtual DailyReportCollection GetUserReportsByMonth(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            string    account = request.GetString("account", YZAuthHelper.LoginUserAccount);
            DateTime  month   = request.GetDateTime("month");

            DailyReportCollection rv;

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    rv = DailyReportManager.GetReports(provider, cn, account, month.Year, month.Month);
                }
            }

            return(this.ConvertToMonthDayResult(month, rv));
        }
예제 #7
0
        public virtual object GetAppLog(HttpContext context)
        {
            YZRequest request = new YZRequest(context);

            BPMObjectNameCollection sids;

            using (BPMConnection bpmcn = new BPMConnection())
            {
                bpmcn.WebOpen();
                sids = bpmcn.Token.SIDs;
            }

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    return(LogManager.GetLog(provider, cn, sids, request.GetDateTime("Date"), this.GetFilterString(request, provider), request.GetSortString("LogDate DESC"), request.Start, request.Limit));
                }
            }
        }
예제 #8
0
파일: Footmark.cs 프로젝트: radtek/EMIP
        public virtual object GetTeamList(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            DateTime  date    = request.GetDateTime("date");

            string uid = YZAuthHelper.LoginUserAccount;
            BPMObjectNameCollection accounts = new BPMObjectNameCollection();

            accounts.Add(uid);

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

                MemberCollection positions = OrgSvr.GetUserPositions(bpmcn, uid);
                foreach (Member position in positions)
                {
                    DirectXSCollection xss = position.GetDirectXSs(bpmcn);
                    foreach (DirectXS xs in xss)
                    {
                        if (!accounts.Contains(xs.UserAccount))
                        {
                            accounts.Add(xs.UserAccount);
                        }
                    }
                }

                using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
                {
                    using (IDbConnection cn = provider.OpenConnection())
                    {
                        FootmarkCollection footmarks = FootmarkManager.GetFootmarks(provider, cn, accounts, date);
                        return(new
                        {
                            children = this.SerializeAsTeamList(bpmcn, footmarks),
                            unsignedusers = footmarks.GetUnSignedUsers(bpmcn, accounts)
                        });
                    }
                }
            }
        }
예제 #9
0
        protected virtual string GetTimeoutMonitorWorklistFilterString(YZRequest request, IYZDbProvider provider)
        {
            string filter      = null;
            string searchType  = request.GetString("SearchType", null);
            string searchBy    = request.GetString("SearchBy", null);
            string processName = request.GetString("ProcessName", null);

            if (!String.IsNullOrEmpty(processName))
            {
                filter = String.Format("ProcessName=N'{0}'", provider.EncodeText(processName));
            }

            if (!YZStringHelper.EquName(searchType, "AdvancedSearch"))
            {
                filter = provider.CombinCond(filter, "Progress >= 1");
            }
            else
            {
                if (YZStringHelper.EquName(searchBy, "Progress"))
                {
                    decimal minProgress = request.GetDecimal("minProgress");
                    decimal maxProgress = request.GetDecimal("maxProgress", -1);

                    filter = provider.CombinCond(filter, String.Format("Progress >= {0}", minProgress));

                    if (maxProgress != -1)
                    {
                        filter = provider.CombinCond(filter, String.Format("Progress < {0}", maxProgress));
                    }
                }
                else
                {
                    DateTime deadline = request.GetDateTime("Deadline");
                    filter = provider.CombinCond(filter, String.Format("TimeoutDeadline IS NOT NULL AND Progress < 10000 AND TimeoutDeadline <= {0}", provider.DateToQueryString(deadline)));
                }
            }

            return(filter);
        }
예제 #10
0
        protected virtual string GetFilterStringHistoryTaskTaskTable(YZRequest request, IYZDbProvider provider)
        {
            string filter = null;

            string serialNumLike    = null;
            string processNameLike  = null;
            string ownerAccountLike = null;
            string agentAccountLike = null;
            string descriptionLike  = null;
            string taskidEqu        = null;

            string keyword = request.GetString("Keyword", null);

            if (!String.IsNullOrEmpty(keyword))
            {
                serialNumLike    = String.Format("SerialNum LIKE(N'%{0}%')", provider.EncodeText(keyword));
                processNameLike  = String.Format("ProcessName LIKE(N'%{0}%')", provider.EncodeText(keyword));
                ownerAccountLike = String.Format("OwnerAccount LIKE(N'%{0}%')", provider.EncodeText(keyword));
                agentAccountLike = String.Format("AgentAccount LIKE(N'%{0}%')", provider.EncodeText(keyword));
                descriptionLike  = String.Format("Description LIKE(N'%{0}%')", provider.EncodeText(keyword));
                if (YZStringHelper.IsNumber(keyword))
                {
                    taskidEqu = String.Format("TaskID={0}", keyword);
                }
            }

            string processName   = request.GetString("processName", null);
            string status        = request.GetString("status", null);
            string sn            = request.GetString("sn", null);
            string keywordFilter = null;

            if (!String.IsNullOrEmpty(processName))
            {
                filter = provider.CombinCond(filter, String.Format("ProcessName=N'{0}'", provider.EncodeText(processName)));
            }
            else
            {
                keywordFilter = provider.CombinCondOR(keywordFilter, processNameLike);
            }

            DateTime date1 = DateTime.MinValue;
            DateTime date2 = DateTime.MaxValue;

            date1 = request.GetDateTime("reqStart", DateTime.MinValue);
            date2 = request.GetDateTime("reqEnd", DateTime.MaxValue);

            if (date1 != DateTime.MinValue || date2 != DateTime.MaxValue)
            {
                filter = provider.CombinCond(filter, provider.GenPeriodCond("CreateAt", date1, date2));
            }

            if (!String.IsNullOrEmpty(status))
            {
                filter = provider.CombinCond(filter, String.Format("State=N'{0}'", status));
            }

            if (!String.IsNullOrEmpty(sn))
            {
                filter = provider.CombinCond(filter, String.Format("SerialNum LIKE(N'%{0}%')", provider.EncodeText(sn)));
            }
            else
            {
                keywordFilter = provider.CombinCondOR(keywordFilter, serialNumLike);
            }

            keywordFilter = provider.CombinCondOR(keywordFilter, ownerAccountLike);
            keywordFilter = provider.CombinCondOR(keywordFilter, agentAccountLike);
            keywordFilter = provider.CombinCondOR(keywordFilter, taskidEqu);
            keywordFilter = provider.CombinCondOR(keywordFilter, descriptionLike);

            filter = provider.CombinCond(filter, keywordFilter);
            return(filter);
        }
예제 #11
0
        protected virtual string GetFilterStringWorklist(YZRequest request, IYZDbProvider provider)
        {
            string filter = null;

            string searchType = request.GetString("SearchType", null);
            string keyword    = request.GetString("Kwd", null);

            string serialNumLike    = null;
            string processNameLike  = null;
            string ownerAccountLike = null;
            string agentAccountLike = null;
            string stepNameLike     = null;
            string descriptionLike  = null;
            string taskidEqu        = null;

            string specProcessName = request.GetString("SpecProcessName", null);

            if (!String.IsNullOrEmpty(specProcessName))
            {
                string[] processNames      = specProcessName.Split(',');
                string   processNameFilter = null;
                foreach (string processName in processNames)
                {
                    if (String.IsNullOrEmpty(processName))
                    {
                        continue;
                    }

                    processNameFilter = provider.CombinCondOR(processNameFilter, String.Format("ProcessName=N'{0}'", provider.EncodeText(processName)));
                }

                filter = provider.CombinCond(filter, processNameFilter);
            }

            if (!String.IsNullOrEmpty(keyword))
            {
                serialNumLike    = String.Format("SerialNum LIKE(N'%{0}%')", provider.EncodeText(keyword));
                processNameLike  = String.Format("ProcessName LIKE(N'%{0}%')", provider.EncodeText(keyword));
                ownerAccountLike = String.Format("OwnerAccount LIKE(N'%{0}%')", provider.EncodeText(keyword));
                agentAccountLike = String.Format("AgentAccount LIKE(N'%{0}%')", provider.EncodeText(keyword));
                stepNameLike     = String.Format("NodeName LIKE(N'%{0}%')", provider.EncodeText(keyword));
                descriptionLike  = String.Format("Description LIKE(N'%{0}%')", provider.EncodeText(keyword));
                if (YZStringHelper.IsNumber(keyword))
                {
                    taskidEqu = String.Format("TaskID={0}", keyword);
                }
            }

            if (YZStringHelper.EquName(searchType, "AdvancedSearch"))
            {
                string processName     = request.GetString("ProcessName", null);
                string postUserAccount = request.GetString("PostUserAccount", null);
                string periodType      = request.GetString("PostDateType", "").ToLower();
                string taskId          = request.GetString("TaskID", null);
                string serialNum       = request.GetString("SerialNum", null);

                string keywordFilter = null;

                if (!String.IsNullOrEmpty(processName))
                {
                    filter = provider.CombinCond(filter, String.Format("ProcessName=N'{0}'", provider.EncodeText(processName)));
                }
                else
                {
                    keywordFilter = provider.CombinCondOR(keywordFilter, processNameLike);
                }

                if (!String.IsNullOrEmpty(postUserAccount))
                {
                    filter = provider.CombinCond(filter, String.Format("OwnerAccount=N'{0}' OR AgentAccount=N'{0}'", provider.EncodeText(postUserAccount)));
                }
                else
                {
                    keywordFilter = provider.CombinCondOR(keywordFilter, ownerAccountLike);
                    keywordFilter = provider.CombinCondOR(keywordFilter, agentAccountLike);
                }

                DateTime date1 = DateTime.MinValue;
                DateTime date2 = DateTime.MaxValue;
                if (periodType != "all")
                {
                    date1 = request.GetDateTime("PostDate1", DateTime.MinValue);
                    date2 = request.GetDateTime("PostDate2", DateTime.MinValue);
                }

                if (date1 != DateTime.MinValue)
                {
                    filter = provider.CombinCond(filter, provider.GenPeriodCond("CreateAt", date1, date2));
                }

                if (!String.IsNullOrEmpty(taskId) && YZStringHelper.IsNumber(taskId))
                {
                    filter = provider.CombinCond(filter, String.Format("TaskID={0}", taskId));
                }
                else
                {
                    keywordFilter = provider.CombinCondOR(keywordFilter, taskidEqu);
                }

                if (!String.IsNullOrEmpty(serialNum))
                {
                    filter = provider.CombinCond(filter, String.Format("SerialNum LIKE(N'{0}%')", provider.EncodeText(serialNum)));
                }
                else
                {
                    keywordFilter = provider.CombinCondOR(keywordFilter, serialNumLike);
                }

                keywordFilter = provider.CombinCondOR(keywordFilter, stepNameLike);
                keywordFilter = provider.CombinCondOR(keywordFilter, descriptionLike);

                filter = provider.CombinCond(filter, keywordFilter);
            }

            if (YZStringHelper.EquName(searchType, "QuickSearch"))
            {
                string processName   = request.GetString("ProcessName", null);
                string keywordFilter = null;

                if (!String.IsNullOrEmpty(processName))
                {
                    filter = provider.CombinCond(filter, String.Format("ProcessName=N'{0}'", provider.EncodeText(processName)));
                }
                else
                {
                    keywordFilter = provider.CombinCondOR(keywordFilter, processNameLike);
                }

                keywordFilter = provider.CombinCondOR(keywordFilter, taskidEqu);
                keywordFilter = provider.CombinCondOR(keywordFilter, serialNumLike);
                keywordFilter = provider.CombinCondOR(keywordFilter, ownerAccountLike);
                keywordFilter = provider.CombinCondOR(keywordFilter, agentAccountLike);
                keywordFilter = provider.CombinCondOR(keywordFilter, stepNameLike);
                keywordFilter = provider.CombinCondOR(keywordFilter, descriptionLike);
                filter        = provider.CombinCond(filter, keywordFilter);
            }

            return(filter);
        }