コード例 #1
0
        private void DoSelect()
        {
            CommPowerSplit ps = new CommPowerSplit();

            if (ps.IsSurveyRole(UserInfo.UserID, UserInfo.LoginName))
            {
                SearchCriterion.SetSearch("IsFixed", "2");  //固定问卷
                SurveyQuestion[] Ents = SurveyQuestion.FindAll(SearchCriterion);
                this.PageState.Add("DataList", Ents);
            }
            else
            {
                SearchCriterion.SetSearch("IsFixed", "2");  //固定问卷
                string CompanyId = string.Empty;            //公司ID

                //first depend login corpid
                var             Ent = SysUser.Find(UserInfo.UserID);
                UserContextInfo UC  = new UserContextInfo();
                CompanyId = UC.GetUserCurrentCorpId(UserInfo.UserID);

                SearchCriterion.AddSearch("CompanyId", CompanyId);
                SurveyQuestion[] Ents = SurveyQuestion.FindAll(SearchCriterion);
                this.PageState.Add("DataList", Ents);
            }
        }
コード例 #2
0
        private void GetGuid()
        {
            SurveyQuestion ent = new SurveyQuestion();

            ent.IsFixed = "1";

            UserContextInfo UC = new UserContextInfo();

            ent.CompanyId = UC.GetUserCurrentCorpId(UserInfo.UserID);//判断公司登陆

            string sql = @"select top 1 Name from SysGroup where GroupId='{0}' ";

            sql = string.Format(sql, ent.CompanyId);

            object obj = DataHelper.QueryValue(sql);

            if (obj != null)
            {
                ent.CompanyName = obj.ToString();
            }

            ent.State = "2";   //默认停用
            ent.DoCreate();
            this.PageState.Add("Guid", ent.Id);
        }
コード例 #3
0
        /// <summary>
        ///     Set up the application user context for a new session.
        /// </summary>
        /// <returns>The initial <c ref="UserContextInfo" /> for the current user.</returns>
        public static UserContextInfo InstantiateSession()
        {
            UserContextInfo details = GetDefaultContextForCurrentUser();

            SetSessionContext(details);
            return(details);
        }
コード例 #4
0
 public List <Transaction> GetRecentTransactions(UserContextInfo userContextInfo)
 {
     return(new List <Transaction>()
     {
         new Transaction()
         {
             Id = 1,
             Date = DateTime.Now,
             Description = "Trans description 1",
             Money = new Money()
             {
                 Amount = 100, CurrencyCode = CurrencyCode.Inr
             }
         },
         new Transaction()
         {
             Id = 2,
             Date = DateTime.Now,
             Description = "Trans description 2",
             Money = new Money()
             {
                 Amount = 200, CurrencyCode = CurrencyCode.Inr
             }
         }
     });
 }
コード例 #5
0
 public Money GetAccountBalance(UserContextInfo userContextInfo)
 {
     return(new Money()
     {
         Amount = 2000, CurrencyCode = CurrencyCode.Inr
     });
 }
コード例 #6
0
        /// <summary>
        /// 审批人验证 审批人必须pk_corp在该公司才能审批
        /// </summary>
        /// <returns>SQL string</returns>
        private string AppealUsrAuth()
        {
            string CorpId = "";
            // 判断公司登陆
            UserContextInfo UC = new UserContextInfo();

            CorpId = UC.GetUserCurrentCorpId(UserInfo.UserID);

            //判断是否为员工旅游审批人
            string SQL = @"select top 1 TravelWelfareId,TravelWelfareName from  FL_Culture..SysApproveConfig where DeptId is null and CompanyId='{0}'";

            SQL = string.Format(SQL, CorpId);
            DataTable Dt = DataHelper.QueryDataTable(SQL);

            if (Dt.Rows.Count > 0)
            {
                if (Dt.Rows[0]["TravelWelfareId"] + "" == UserInfo.UserID)
                {
                    return(" and CompanyId='" + CorpId + "' ");  //*
                }
                else
                {
                    return(" and 1<>1 ");
                }
            }
            else
            {
                return(" and 1<>1 ");
            }
        }
コード例 #7
0
        public ActionResult ShowAccountInfo()
        {
            ViewBag.Message = "Welcome!";

            decimal balance = 0;

            try
            {
                using (var scope = new OperationContextScope(accountClient.InnerChannel))
                {
                    OperationContext.Current.OutgoingMessageHeaders.Add(GetSecurityTokenHeader());
                    var userInfoFromSession = new UserContextInfo()
                    {
                        //UserId = Session["userid"])
                        //BankBranch = Session["BankBranch"]
                        //ExtensionData = Session["sometablestructure"])
                    };

                    var accountBalance = accountClient.GetAccountBalance(userInfoFromSession);
                    balance = accountBalance.Amount;
                }
            }
            catch (FaultException fe)
            {
                ViewBag.Message = fe.Message;
            }

            return(View("Account", new AccountInfoViewModel()
            {
                AccountBalance = balance
            }));
        }
コード例 #8
0
        private void Doselect()
        {
            string SurveyId = RequestData.Get("SurveyId") + "";

            //V_SurveyAnswerExplain[] Ents = V_SurveyAnswerExplain.FindAllByProperties("SurveyId", SurveyId);

            string where = "";
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!String.IsNullOrEmpty(item.Value.ToString()))
                {
                    switch (item.PropertyName)
                    {
                    case "StartTime":
                        where += " and CreateTime>='" + item.Value + "' ";
                        break;

                    case "EndTime":
                        where += " and CreateTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' ";
                        break;

                    default:
                        where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                        break;
                    }
                }
            }

            var SEnt = SurveyQuestion.TryFind(SurveyId);

            if (SEnt != null && SEnt.IsFixed == "2")
            {
                CommPowerSplit PS = new CommPowerSplit();
                if (PS.IsHR(UserInfo.UserID, UserInfo.LoginName) || PS.IsAdmin(UserInfo.LoginName) || PS.IsInAdminsRole(UserInfo.UserID))
                {
                }
                else
                {
                    UserContextInfo UC = new UserContextInfo();
                    where += " and B.pk_corp='" + UC.GetUserCurrentCorpId(UserInfo.UserID) + "' ";
                }
            }

            string SQL = @"SELECT distinct A.* from FL_Culture..V_SurveyAnswerExplain As A
	                        left join FL_PortalHR..SysUser as B
		                        on A.UserId=B.UserID
                            where SurveyId='{0}' ";

            SQL  = string.Format(SQL, SurveyId);
            SQL  = SQL.Replace("FL_PortalHR", Global.AimPortalDB);
            SQL += where;

            this.PageState.Add("DataList", GetPageData(SQL, SearchCriterion));
            // this.PageState.Add("DataList", Ents);
        }
コード例 #9
0
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            string where = string.Empty;
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!String.IsNullOrEmpty(item.Value.ToString()))
                {
                    switch (item.PropertyName)
                    {
                    case "CreateTime":

                        where += " year(CreateTime)=" + item.Value + " ";
                        break;
                    }
                }
            }
            SearchCriterion.RemoveSearch("CreateTime");
            SearchCriterion.SetOrder(TravelMoneyConfig.Prop_Corp);             //公司
            SearchCriterion.SetOrder(TravelMoneyConfig.Prop_Indutydate, true); //日期

            CommPowerSplit PS     = new CommPowerSplit();
            SysUser        UsrEnt = SysUser.Find(UserInfo.UserID);

            if (PS.TraveMoneyConfig(UserInfo.UserID, UserInfo.LoginName)) //总部HR权限  HR1
            {
                if (!string.IsNullOrEmpty(where))
                {
                    ents = TravelMoneyConfig.FindAll(SearchCriterion, Expression.Sql(where));
                    this.PageState.Add("TravelMoneyConfigList", ents);
                }
                else
                {
                    ents = TravelMoneyConfig.FindAll(SearchCriterion);
                    this.PageState.Add("TravelMoneyConfigList", ents);
                }
            }
            else
            {
                //公司权限
                UserContextInfo UC = new UserContextInfo();
                SearchCriterion.SetSearch(TravelMoneyConfig.Prop_Corp, UC.GetUserCurrentCorpId(UserInfo.UserID));

                if (!string.IsNullOrEmpty(where))
                {
                    ents = TravelMoneyConfig.FindAll(SearchCriterion, Expression.Sql(where));
                    this.PageState.Add("TravelMoneyConfigList", ents);
                }
                else
                {
                    ents = TravelMoneyConfig.FindAll(SearchCriterion);
                    this.PageState.Add("TravelMoneyConfigList", ents);
                }
            }
        }
コード例 #10
0
        string type = String.Empty; // 对象类型

        #endregion


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

            UseWelfareNote ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent           = this.GetMergedData <UseWelfareNote>();
                ent.NoticeWay = NoticeWay;
                ent.DoUpdate();
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent            = this.GetPostedData <UseWelfareNote>();
                ent.NoticeWay  = NoticeWay;
                ent.State      = "0";  //0  创建 1 发起 2 撤销
                ent.CreateTime = DateTime.Now;

                // 判断公司登陆
                string          CorpIds = string.Empty;
                UserContextInfo UC      = new UserContextInfo();
                CorpIds = UC.GetUserCurrentCorpId(UserInfo.UserID);

                ent.CreateCorp = CorpIds;
                ent.DoCreate();
                break;

            default:
                if (RequestActionString == "GetNextUsers")
                {
                    GetNextUsers();
                }
                else if (RequestActionString == "submitfinish")
                {
                    SubmitFinish();
                }
                else
                {
                    Doselect();
                }
                break;
            }
        }
コード例 #11
0
        public void SurveyStatistic(string SurveyId)
        {
            //sql = string.Format(sql, SurveyId);
            //权限过滤
            var SEnt = SurveyQuestion.TryFind(SurveyId);

            if (SEnt != null && SEnt.IsFixed == "2")
            {
                CommPowerSplit PS = new CommPowerSplit();
                if (PS.IsHR(UserInfo.UserID, UserInfo.LoginName) || PS.IsAdmin(UserInfo.LoginName) || PS.IsInAdminsRole(UserInfo.UserID))
                {
                }
                else
                {
                    UserContextInfo UC  = new UserContextInfo();
                    string          SQL = "exec FL_Culture..pro_SummarySurvey_Fix '{0}','{1}' ";
                    SQL = string.Format(SQL, SurveyId, UC.GetUserCurrentCorpId(UserInfo.UserID));
                    this.PageState.Add("DataList", DataHelper.QueryDataTable(SQL));
                    return;
                }
            }

            string sql = "";

            sql = "select * from FL_Culture..SummarySurvey where SurveyId='{0}' order by SortIndex ";
            sql = string.Format(sql, SurveyId);
            var Ents = DataHelper.QueryDataTable(sql);

            if (Ents.Rows.Count != 0)
            {
                this.PageState.Add("DataList", Ents);
            }
            else
            {
                sql  = "exec FL_Culture..pro_SummarySurvey '{0}'";
                sql  = string.Format(sql, SurveyId);
                Ents = DataHelper.QueryDataTable(sql);
                this.PageState.Add("DataList", Ents);
            }
            //  this.PageState.Add("DataList", Ents);

            //if()



            //sql = @"select *  from FL_Culture..QuestionItem  where SurveyId='{0}' and QuestionType like '%填写项%' ";
            //sql = string.Format(sql, Id);
            //this.PageState.Add("FillQuestion", DataHelper.QueryDictList(sql));
        }
コード例 #12
0
        //
        private void DoSelect()
        {
            string sort = RequestData.Get("sort") + "";
            string tp   = RequestData.Get("tp") + ""; //my个人积分 mgr 管理员

            string where = "";
            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;
                    }
                }
            }
            string sql = " select * from FL_Culture..V_SurveyScore where UserName is not null  ";

            if (tp.Contains("mgr"))   //角色验证-->配置
            {
                CommPowerSplit ps = new CommPowerSplit();
                if (ps.IsScoreRole(UserInfo.UserID, UserInfo.LoginName))
                {
                    this.PageState.Add("Power", "1");
                }
                else //分公司判断
                {
                    string          corp = string.Empty;
                    UserContextInfo UC   = new UserContextInfo();
                    corp = UC.GetUserCurrentCorpId(UserInfo.UserID);

                    this.PageState.Add("Power", "1");
                    where += " and CorpId='" + corp + "' ";
                }
            }
            else if (tp.Contains("my")) //个人
            {
                where += " and UserID='" + UserInfo.UserID + "' ";
                this.PageState.Add("Power", "0");
            }

            sql += where;
            this.PageState.Add("DataList", GetPageData(sql, SearchCriterion));
        }
コード例 #13
0
        private void ImpExcel()
        {
            string where = string.Empty;
            //权限过滤
            var Ent = SurveyQuestion.TryFind(SurveyId);

            if (Ent != null && Ent.IsFixed == "2")
            {
                CommPowerSplit PS = new CommPowerSplit();
                if (PS.IsInAdminsRole(UserInfo.UserID) || PS.IsAdmin(UserInfo.LoginName) || PS.IsHR(UserInfo.UserID, UserInfo.LoginName))
                {
                }
                else
                {
                    UserContextInfo UC = new UserContextInfo();
                    where += " and D.Pk_corp='" + UC.GetUserCurrentCorpId(UserInfo.UserID) + "' ";
                }
            }

            tmpSQL = tmpSQL.Replace("##QUERY##", where);
            tmpSQL = tmpSQL.Replace("HR_OA_MiddleDB", Global.HR_OA_MiddleDB);
            string    sql        = string.Format(tmpSQL, SurveyId);
            string    path       = RequestData.Get <string>("path");
            string    fileName   = RequestData.Get <string>("fileName");
            string    xlsName    = fileName + "_" + System.DateTime.Now.ToString("yyyMMddhhmmss");
            DataTable forExcelDt = DataHelper.QueryDataTable(sql);

            if (forExcelDt.Rows.Count > 0)
            {
                forExcelDt.TableName = "data";
                WorkbookDesigner designer   = new WorkbookDesigner();
                string           xlsMdlPath = Server.MapPath(path);
                designer.Open(xlsMdlPath);
                designer.SetDataSource(forExcelDt);
                designer.Process();
                Aspose.Cells.Worksheet ws = designer.Workbook.Worksheets.GetSheetByCodeName(fileName);

                string newXls = xlsName + ".xls";
                System.IO.DirectoryInfo xlspath = new System.IO.DirectoryInfo(Server.MapPath("../Excel/tempexcel"));
                ExcelHelper.deletefile(xlspath);
                designer.Save(Server.MapPath("../Excel/tempexcel") + "\\" + newXls, FileFormatType.Excel2003);
                this.PageState.Add("fileName", "/Excel/tempexcel/" + newXls);
            }
        }
コード例 #14
0
        /// <summary>
        /// Vrací informace o přihlášeném uživateli.
        /// Pro nepřihlášeného uživatele vrací null.
        /// </summary>
        public UserContextInfo GetUserContextInfo(ClaimsPrincipal principal)
        {
            // nelze použít httpContextAccessor.HttpContext.User.Identity.IsAuthenticated, protože jeho Identity.IsAuthenticated v tento okamžik
            // ještě false (ačkoliv pro principal z parametru je true).
            if (!principal.Identity.IsAuthenticated)
            {
                return(null);
            }

            if (userContextInfo == null)
            {
                // vyzvedneme claim s username; nelze principal.Identity.Name, který je v daný okamžik ještě null
                Claim usernameClaim = principal.Claims.Single(claim => claim.Type == ClaimTypes.NameIdentifier);

                userContextInfo = new UserContextInfo(username: usernameClaim.Value);
            }

            return(userContextInfo);
        }
コード例 #15
0
        private void CreateGuid()
        {
            SurveyQuestion ent = new SurveyQuestion();
            var            Et  = SysUser.Find(UserInfo.UserID);

            ent.IsFixed = "0";                          //0 一般调查问卷
            UserContextInfo UC = new UserContextInfo();

            ent.CompanyId = UC.GetUserCurrentCorpId(UserInfo.UserID); //判断公司登陆

            //部门
            string DeptSQL = @"select A.UserID,A.WorkNo,A.Name,B.GroupID as CropId,B.Name as CropName,
                                    C.GroupID as DeptId,C.Name as DeptName
                             from FL_PortalHR..SysUser As A
	                            left join FL_PortalHR..SysGroup As B
                              on  A.Pk_corp=B.GroupID
	                            left join  FL_PortalHR..SysGroup As C
                              on A.Pk_deptdoc=C.GroupID
                            where UserID='{0}' and  A.pk_corp='{1}' ";

            DeptSQL = DeptSQL.Replace("FL_PortalHR", Global.AimPortalDB);
            DeptSQL = string.Format(DeptSQL, UserInfo.UserID, Et.Pk_corp);

            DataTable dt = DataHelper.QueryDataTable(DeptSQL);

            if (dt.Rows.Count > 0)
            {
                ent.CompanyId   = dt.Rows[0]["CropId"].ToString();
                ent.CompanyName = dt.Rows[0]["CropName"].ToString();

                ent.DeptId   = dt.Rows[0]["DeptId"].ToString();
                ent.DeptName = dt.Rows[0]["DeptName"].ToString();
            }
            else
            {
                ent.CompanyName = DataHelper.QueryValue("select * from sysgroup where GroupId='" + ent.CompanyId + "'") + "";
            }

            ent.DoCreate();
            this.PageState.Add("Guid", ent.Id);
        }
コード例 #16
0
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            var    UserEnt = SysUser.Find(UserInfo.UserID);
            string CorpIds = string.Empty;

            CommPowerSplit ps = new CommPowerSplit();

            if (ps.IsNoticeRole(UserInfo.UserID, UserInfo.LoginName))
            {
                ents = UseWelfareNote.FindAll(SearchCriterion);
            }
            else
            {
                // 判断公司登陆
                UserContextInfo UC = new UserContextInfo();
                CorpIds = UC.GetUserCurrentCorpId(UserInfo.UserID);

                SearchCriterion.SetSearch("CreateCorp", CorpIds);
                ents = UseWelfareNote.FindAll(SearchCriterion);
            }
            this.PageState.Add("UseWelfareNoteList", ents);
        }
コード例 #17
0
        /// <summary>
        /// 审批人配置判断
        /// </summary>
        private void GetApproveUser()
        {
            var    UsrEnt = SysUser.Find(UserInfo.UserID);
            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, UsrEnt.Pk_deptdoc);
            string DeptPathStr = DataHelper.QueryValue(SQL) + "";

            // 判断公司登陆
            string          CorpIds = string.Empty;
            UserContextInfo UC      = new UserContextInfo();

            CorpIds = UC.GetUserCurrentCorpId(UserInfo.UserID);

            //选取配置最近的配置  HR经理
            SQL = @"select top 1 HRManagerId As UserID,HRManagerName As Name ,
	                                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 HRManagerId is not null  order by SortIndex";
            SQL = string.Format(SQL, CorpIds, DeptPathStr);

            DataTable AppUsrDt = DataHelper.QueryDataTable(SQL);
            string    status   = AppUsrDt.Rows.Count > 0 ? "1" : "0";

            this.PageState.Add("Status", status);
        }
コード例 #18
0
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            string CorpId = string.Empty;

            string where = string.Empty;
            var UsrEnt = SysUser.Find(UserInfo.UserID);

            CommPowerSplit ps = new CommPowerSplit();

            if (ps.IsNoticeRole(UserInfo.UserID, UserInfo.LoginName))
            {
                where += " (WorkFlowState='1' or WorkFlowState='2' or WorkFlowState='-1') ";
                if (!string.IsNullOrEmpty(SearchCriterion.GetSearchValue("Year") + ""))
                {
                    where += "  and  year(ApplyTime)= " + SearchCriterion.GetSearchValue("Year") + " ";
                }
                SearchCriterion.RemoveSearch("Year");
                ents = UsrTravelWelfare.FindAll(SearchCriterion, Expression.Sql(where));
                this.PageState.Add("UsrTravelWelfareList", ents);
            }
            else
            {
                // 判断公司登陆
                UserContextInfo UC = new UserContextInfo();
                CorpId = UC.GetUserCurrentCorpId(UserInfo.UserID);

                //SearchCriterion.AddSearch("CompanyId", CorpId);
                where += " (WorkFlowState='1' or WorkFlowState='2' or WorkFlowState='-1') " + AppealUsrAuth();
                if (!string.IsNullOrEmpty(SearchCriterion.GetSearchValue("Year") + ""))
                {
                    where += "  and  year(ApplyTime)= " + SearchCriterion.GetSearchValue("Year") + " ";
                }
                SearchCriterion.RemoveSearch("Year");
                SearchCriterion.SetOrder("CompanyId", true);
                ents = UsrTravelWelfare.FindAll(SearchCriterion, Expression.Sql(where));
                this.PageState.Add("UsrTravelWelfareList", ents);
            }
        }
コード例 #19
0
        /// <summary>
        /// 生成状态检查
        /// </summary>
        private void CreateCheck()
        {
            string          CorpId = string.Empty;
            UserContextInfo UC     = new UserContextInfo();

            CorpId = UC.GetUserCurrentCorpId(UserInfo.UserID);

            string sql = string.Empty;

            string CheckStr = "C|" + CorpId + "_" + UserInfo.UserID + "";  //生成标志

            sql = @"select sum(T) As T from 
                    (
	                    select count(*) As T from  FL_Culture..TravelMoneyConfig where year(createtime)={0} and Ext1='{1}'
	                    union all
	                    select count(*) As T from  FL_Culture..TravelMoneyConfig where year(createtime)={0} and Corp='{2}'
                    ) As T";
            sql = string.Format(sql, DateTime.Now.Year, CheckStr, CorpId);

            try
            {
                int a = DataHelper.QueryValue <int>(sql);
                if (a > 0)
                {
                    this.PageState.Add("staus", "0");
                }
                else
                {
                    this.PageState.Add("staus", "1");
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
コード例 #20
0
        /// <summary>
        /// 查询导出
        /// </summary>
        private void QryAndImpExcel()
        {
            string where = "";
            string Corp     = RequestData.Get("Corp") + "";
            string WorkNo   = RequestData.Get("WorkNo") + "";
            string UserName = RequestData.Get("UserName") + "";
            string JobName  = RequestData.Get("JobName") + "";
            string WorkAge  = RequestData.Get("WorkAge") + "";
            string SurveyId = RequestData.Get("SurveyId") + "";
            string title    = RequestData.Get("title") + "";

            if (!string.IsNullOrEmpty(Corp))
            {
                where += " and A.Corp like '%" + Corp + "%' ";
            }
            if (!string.IsNullOrEmpty(WorkNo))
            {
                where += " and A.WorkNo like '%" + WorkNo + "%' ";
            }
            if (!string.IsNullOrEmpty(UserName))
            {
                where += " and A.UserName like '%" + UserName + "%' ";
            }
            if (!string.IsNullOrEmpty(JobName))
            {
                where += " and A.JobName like '%" + JobName + "%' ";
            }
            if (!string.IsNullOrEmpty(WorkAge))
            {
                where += " and A.WorkAge like '%" + WorkAge + "%' ";
            }

            string sql = @"select 
	                              newid() '编号',
                                  A.WorkNo '工号', UserName '姓名',A.Sex '性别',Corp '公司',Dept '部门',convert(varchar(10),A.Indutydate,120) '入职日期',WorkAge '工龄',Crux '关键岗位',
                                  convert(varchar(10), BornDate,120) '出生日期',A.Age '年龄',JobName '岗位',JobDegree '岗位等级',JobSeq '岗位序列',Skill '技能',A.Content, A.QuestionType,
                                  Case when Explanation<>'' then A.Answer+'(' + Explanation+')'  else A.Answer End As Answer,
	                              B.SortIndex As P, C.SortIndex As S 
                            from  FL_Culture..SummarySurvey_detail As A 
                             left join FL_Culture..QuestionItem As B 
	                            on B.Id=A.QuestionId and A.SurveyId=B.SurveyId
                             left join FL_Culture..QuestionAnswerItem As C 
	                            on A.SurveyId=C.SurveyId and  A.QuestionItemId=C.Id
                             left join FL_PortalHR..SysUser As D
	                            on A.WorkNo=D.WorkNo
                            where  A.SurveyId='{0}' and  A.WorkNo is not null ##query##
                            order by A.UserId, P,S ";

            //权限过滤
            var SEnt = SurveyQuestion.TryFind(SurveyId);

            if (SEnt != null && SEnt.IsFixed == "2") //IsFixed "2" 常用问卷
            {
                CommPowerSplit PS = new CommPowerSplit();
                if (PS.IsInAdminsRole(UserInfo.UserID) || PS.IsAdmin(UserInfo.LoginName) || PS.IsHR(UserInfo.UserID, UserInfo.LoginName))
                {
                }
                else
                {
                    UserContextInfo UC = new UserContextInfo();
                    where += " and D.Pk_corp='" + UC.GetUserCurrentCorpId(UserInfo.UserID) + "' ";
                }
            }

            if (!string.IsNullOrEmpty(where))
            {
                sql = sql.Replace("##query##", where);
            }
            else
            {
                sql = sql.Replace("##query##", "");
            }

            sql = sql.Replace("FL_PortalHR", Global.AimPortalDB);
            sql = sql.Replace("HR_OA_MiddleDB", Global.HR_OA_MiddleDB);
            sql = string.Format(sql, SurveyId);
            DataTable OrigDt = DataHelper.QueryDataTable(sql);

            DataTable newDt = CreateNewTable(OrigDt, SurveyId, "IMP");

            newDt.Columns.Remove("编号");
            newDt.Columns.Remove("Content");
            newDt.Columns.Remove("QuestionType");
            newDt.Columns.Remove("Answer");

            if (title.Contains("内部服务评分"))
            {
                string CorpStr = string.Empty;
                for (int i = 0; i < newDt.Rows.Count; i++)
                {
                    if (i > 0)
                    {
                        CorpStr += ",";
                    }
                    CorpStr += newDt.Rows[i]["公司"] + "";
                }
                string[] CorpArr = CorpStr.Split(',');

                string   DeptStr = @"财务管理中心,信息管理中心,综合管理中心,物流研发中心,物流事业部,法务稽核部,营销服务中心,人力资源中心,海运事业部,空运事业部,商业发展部";
                string[] DeptArr = DeptStr.Split(',');

                ExportExcel(DeptArr, CorpArr, title);
                return;
            }
            else
            {
                string xlsName    = title + "_" + System.DateTime.Now.ToString("yyyMMddhhmm") + ".xls";
                string FilnalName = Server.MapPath("../Excel/tempexcel") + "/" + xlsName;

                OutFileToDisk(newDt, "DataSource2", FilnalName);
                this.PageState.Add("fileName", "/Excel/tempexcel/" + xlsName);
            }
        }
コード例 #21
0
        private void DefaultSelect()
        {
            string where = "";
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!String.IsNullOrEmpty(item.Value.ToString()))
                {
                    switch (item.PropertyName)
                    {
                    default:
                        where += " and A." + item.PropertyName + " like '%" + item.Value + "%' ";
                        break;
                    }
                }
            }
            //iframe
            string qstSQl = string.Empty;

            if (!string.IsNullOrEmpty(RequestData.Get("type") + ""))
            {
                if (!string.IsNullOrEmpty(RequestData.Get("Qty") + ""))
                {
                    string Qty = RequestData.Get("Qty") + "";
                    switch ((RequestData.Get("GroupType") + "").Trim().ToLower())
                    {
                    case "corp":     //公司维度
                        where += " and A.Corp='" + Qty + "' ";
                        break;

                    case "sex":
                        where += " and A.Sex='" + Qty + "' ";
                        break;

                    case "workage":
                        if (Qty.Contains("未知"))
                        {
                            where += " and A.WorkAge is  null ";
                        }
                        else
                        {
                            where += " and A.WorkAge=" + Qty + " ";
                        }
                        break;

                    case "ageseg":
                    {
                        string   OraStr = Qty;
                        string[] Arr    = Qty.Split('-');
                        if (Arr.Length > 1)
                        {
                            where += " and A.Age between " + Arr[0] + " and " + Arr[1] + " ";
                        }
                        else
                        {
                            where += " and A.age " + Arr[0] + " ";
                        }
                    }
                    break;
                    }

                    string QuestionId     = RequestData.Get("QuestionId") + "";
                    string QuestionItemId = RequestData.Get("QuestionItemId") + "";
                    if (!String.IsNullOrEmpty(QuestionId) && !string.IsNullOrEmpty(QuestionItemId))
                    {
                        string tmpSQL = @"  and A.WorkNo in 
		                            (
			                            select Distinct WorkNo from FL_Culture..SummarySurvey_detail As A
			                            where  A.SurveyId='{0}'
			                            and QuestionId='{1}' 
			                            and QuestionItemId='{2}'
		                            ) "        ;
                        qstSQl = string.Format(tmpSQL, SurveyId, QuestionId, QuestionItemId);
                    }
                }
            }


            //权限过滤
            var Ent = SurveyQuestion.TryFind(SurveyId);

            if (Ent != null && Ent.IsFixed == "2")
            {
                CommPowerSplit PS = new CommPowerSplit();
                if (PS.IsInAdminsRole(UserInfo.UserID) || PS.IsAdmin(UserInfo.LoginName) || PS.IsHR(UserInfo.UserID, UserInfo.LoginName))
                {
                }
                else
                {
                    UserContextInfo UC = new UserContextInfo();
                    where += " and B.Pk_corp='" + UC.GetUserCurrentCorpId(UserInfo.UserID) + "' ";
                }
            }

            //查询SQL
            string sql = @"select * from FL_Culture..SummarySurvey_detail As A
                            left join FL_PortalHR..SysUser As B 
			                     on A.WorkNo=B.WorkNo
                            where SurveyId='{0}' and 1=1  ";

            sql = sql + where + qstSQl;
            sql = string.Format(sql, SurveyId);
            sql = sql.Replace("FL_PortalHR", Global.AimPortalDB);
            DataTable OrigDt = DataHelper.QueryDataTable(sql);

            DataTable newDt = CreateNewTable(OrigDt, SurveyId, "");
            DataTable dt    = GetPagedTable(newDt, SearchCriterion.CurrentPageIndex, SearchCriterion.PageSize);

            SearchCriterion.RecordCount = newDt.Rows.Count;
            PageState.Add("DataList", dt);
        }
コード例 #22
0
        private void Doeselect()
        {
            string where = "";
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!String.IsNullOrEmpty(item.Value.ToString()))
                {
                    switch (item.PropertyName)
                    {
                    case "StartTime":
                        where += " and StartTime>='" + item.Value + "' ";
                        break;

                    case "EndTime":
                        where += " and StartTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' ";
                        break;

                    default:
                        where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                        break;
                    }
                }
            }

            string SQL = string.Empty;

            //问卷角色或管理员
            CommPowerSplit Role = new CommPowerSplit();

            if (Role.IsSurveyRole(UserInfo.UserID, UserInfo.LoginName))
            {
                SQL = @" select A.*,B.SummitCount
                            from FL_Culture..SurveyQuestion  As A 
                            left join 
                            ( 
	                            select SurveyId ,count(*) As SummitCount from FL_Culture..SurveyCommitHistory group by  SurveyId 
                            ) As B
                            on  A.Id=B.SurveyId
                            where A.IsFixed='0' and ( A.state='1' or A.state='2' ) ";
            }
            else
            {
                string          CompanyId = string.Empty;
                UserContextInfo UC        = new UserContextInfo();
                CompanyId = UC.GetUserCurrentCorpId(UserInfo.UserID); //判断公司登陆

                //(A.state='1' or A.state='2') 开始 结束
                SQL = @" select A.*,B.SummitCount
                            from FL_Culture..SurveyQuestion  As A 
                            left join 
                            ( 
	                            select SurveyId ,count(*) As SummitCount from FL_Culture..SurveyCommitHistory group by  SurveyId 
                            ) As B
                            on  A.Id=B.SurveyId
                         where A.IsFixed='0' and A.CompanyId='{0}' and (A.state='1' or A.state='2') ";
                SQL = string.Format(SQL, CompanyId);
            }

            SQL += where;
            this.PageState.Add("DataList", GetPageData(SQL, SearchCriterion));
        }
コード例 #23
0
        private void DoSelect()
        {
            // 角色 根据公司,部门找到配置的HR,然后具有查看权限
            string where = string.Empty, Company = string.Empty;
            string sql = @"select B.WorkNo,A.*,A.CorpName+'/'+A.DeptName As Org from FL_Culture..EmpVoiceAskQuestion As A
                        left join FL_PortalHR..SysUser As B
                        on A.CreateId=B.UserID
                        where 1=1 and Category<>''  ";

            sql = sql.Replace("FL_PortalHR", Global.AimPortalDB);

            //公司权限
            CommPowerSplit ps = new CommPowerSplit();

            if (!ps.IsEmpVoiceRole(UserInfo.UserID, UserInfo.LoginName))
            {
                //获取人员部门
                var    UsrEnt = SysUser.Find(UserInfo.UserID);
                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, UsrEnt.Pk_deptdoc);
                string DeptPathStr = DataHelper.QueryValue(SQL).ToString();
                DeptPathStr = string.IsNullOrEmpty(DeptPathStr) ? "" : DeptPathStr;


                //找到配置的HR专员(HRUsrId)
                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 HRUsrId is not null
                                and ( HRUsrId='{2}' or HRManagerId='{2}'  ) order by SortIndex";

                // 判断公司登陆
                UserContextInfo UC = new UserContextInfo();
                Company = UC.GetUserCurrentCorpId(UserInfo.UserID);

                SQL = string.Format(SQL, Company, DeptPathStr, UserInfo.UserID);

                DataTable dt = DataHelper.QueryDataTable(SQL);
                if (dt.Rows.Count > 0)
                {
                    where += "  and  CorpId= '" + Company + "' ";
                }
                else
                {
                    where += "  and  1<>1 ";
                }
            }
            //分类
            if (!string.IsNullOrEmpty(nodeName) && (nodeName != "所有分类") && nodeName != "null")
            {
                sql += " and Category='" + nodeName + "' ";
            }
            sql += where;

            string qry = "";

            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!String.IsNullOrEmpty(item.Value.ToString()))
                {
                    switch (item.PropertyName)
                    {
                    case "StartTime":
                        qry += " and CreateTime>='" + item.Value + "' ";
                        break;

                    case "EndTime":
                        qry += " and CreateTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' ";
                        break;

                    default:
                        qry += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                        break;
                    }
                }
            }
            sql += qry;
            SearchCriterion.SetOrder(EmpVoiceAskQuestion.Prop_CreateTime);
            OrderCriterionItem oci1 = new OrderCriterionItem(EmpVoiceAskQuestion.Prop_CreateTime);

            SearchCriterion.Orders.Add(oci1);
            this.PageState.Add("DataList", GetPageData(sql, SearchCriterion));
        }
コード例 #24
0
        public ActionResult ShowAccountInfo()
        {
            ViewBag.Message = "Welcome!";

            decimal balance = 0;

            try
            {
                using (var scope = new OperationContextScope(accountClient.InnerChannel))
                {

                    OperationContext.Current.OutgoingMessageHeaders.Add(GetSecurityTokenHeader());
                    var userInfoFromSession = new UserContextInfo()
                    {
                        //UserId = Session["userid"])
                        //BankBranch = Session["BankBranch"]
                        //ExtensionData = Session["sometablestructure"])
                    };

                    var accountBalance = accountClient.GetAccountBalance(userInfoFromSession);
                    balance = accountBalance.Amount;
                }
            }
            catch (FaultException fe)
            {

                ViewBag.Message = fe.Message;
            }

            return View("Account",new AccountInfoViewModel()
            {
                AccountBalance = balance
            });
        }
コード例 #25
0
        /// <summary>
        /// 获取人员
        /// </summary>
        private void GetNextUsers()
        {
            string CurrentNode = RequestData.Get <string>("taskName");
            string nextName = RequestData.Get <string>("nextName");
            string UserId = string.Empty, UserName = string.Empty;
            string CorpIds = string.Empty;   //公司ID

            // according id find create user
            SysUser       UsrEnt = null;
            UsrAppealList AppEnt = UsrAppealList.TryFind(id);

            if (AppEnt != null)
            {
                UsrEnt  = SysUser.Find(AppEnt.UserId);
                CorpIds = UsrEnt.Pk_corp;
            }
            else
            {
                // 判断公司登陆
                UserContextInfo UC = new UserContextInfo();
                CorpIds = UC.GetUserCurrentCorpId(UserInfo.UserID);
                UsrEnt  = SysUser.Find(UserInfo.UserID);
            }

            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, UsrEnt.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 HRUsrId is not null  order by SortIndex";
            SQL = string.Format(SQL, CorpIds, DeptPathStr);

            DataTable dt = DataHelper.QueryDataTable(SQL);

            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }


            //HR专员-->HR经理(一级组织负责人)-->总部HR专员--->总部HR经理
            if (CurrentNode == "AppealUsr" && string.IsNullOrEmpty(nextName))//申诉人
            {
                if (!string.IsNullOrEmpty(id))
                {
                    var Ent = UsrAppealList.Find(id);
                    if (ent != null)
                    {
                        UserId   = Ent.UserId;
                        UserName = Ent.UserName;
                    }
                }
            }
            else if (CurrentNode == "AppealUsr" && nextName == "提交") //申诉人-->HR专员
            {
                UserId   = dt.Rows[0]["HRUsrId"].ToString();
                UserName = dt.Rows[0]["HRUserName"].ToString();
            }
            else if (CurrentNode == "AppealUsr" && nextName == "上诉") //申诉人-->总部HR专员
            {
                //需跳环节
                //                string sql = @"select * from Task where PatIndex('%{0}%',EFormName)>0  and Status='4'
                //                             and ApprovalNodeName='总部HR经理' order by FinishTime asc";
                //                sql = string.Format(sql, id);
                //                DataTable rowDt = DataHelper.QueryDataTable(sql);
                //                if (rowDt.Rows.Count > 0)                               //申诉人-->总部HR经理-->HR总监
                //                {
                //                    UserId = dt.Rows[0]["HQHRMajorId"].ToString();
                //                    UserName = dt.Rows[0]["HQHRMajorName"].ToString();
                //                }
                //                else
                //                {
                UserId   = dt.Rows[0]["HQHRUserId"].ToString();
                UserName = dt.Rows[0]["HQHRUserName"].ToString();
                // }
            }
            else if (CurrentNode == "HRUsr" && string.IsNullOrEmpty(nextName)) //申诉人-->HR专员
            {
                UserId   = dt.Rows[0]["HRUsrId"].ToString();
                UserName = dt.Rows[0]["HRUserName"].ToString();
            }
            else if (CurrentNode == "HRUsr" && nextName == "提交上一级")    //Hr专员--> HR经理
            {
                UserId   = dt.Rows[0]["HRManagerId"].ToString();
                UserName = dt.Rows[0]["HRManagerName"].ToString();
            }
            else if (CurrentNode == "HQHRUser" && nextName == "提交上一级") //总部HR专员--> 总部HR经理
            {
                UserId   = dt.Rows[0]["HQHRManagerId"].ToString();
                UserName = dt.Rows[0]["HQHRManagerName"].ToString();
            }
            else if (CurrentNode == "HQHRManager" && nextName == "提交上一级") // 总部HR经理---->总部HR总监
            {
                UserId   = dt.Rows[0]["HQHRMajorId"].ToString();
                UserName = dt.Rows[0]["HQHRMajorName"].ToString();
            }

            //else if (CurrentNode == "CompanyLeader")   //一级组织负责人
            //{
            //    UserId = dt.Rows[0]["CompanyLeaderId"].ToString();
            //    UserName = dt.Rows[0]["CompanyLeaderName"].ToString();

            PageState.Add("NextUsers", new { nextUserId = UserId, nextUserName = UserName });
        }
コード例 #26
0
        /// <summary>
        /// 生成旅游金额
        /// </summary>
        private void CreateMoney()
        {
            string          CorpId = string.Empty;
            UserContextInfo UC     = new UserContextInfo();

            CorpId = UC.GetUserCurrentCorpId(UserInfo.UserID);

            EasyDictionary LimitDate    = SysEnumeration.GetEnumDict("TravelLimitDate");
            string         limitDateStr = string.Empty;

            if ((LimitDate["LimitDate"] + "").ToUpper() == "2L") //2 月最后一天
            {
                limitDateStr = "'" + GetLastDayOfMonth(DateTime.Now.Year, 2).ToString("yyyy-MM-dd") + "'";
            }
            else
            {
                string prefix = LimitDate["LimitDate"] + "";
                limitDateStr = "'" + DateTime.Now.Year + "-" + prefix + "'";
            }

            EasyDictionary Dic   = SysEnumeration.GetEnumDict("BaseMoney");
            string         One   = Dic[">1<5"] + "";
            string         Two   = Dic[">=5<10"] + "";
            string         Three = Dic[">=10<15"] + "";
            string         Four  = Dic[">=15<20"] + "";

            EasyDictionary DicBase       = SysEnumeration.GetEnumDict("WorkYearMoney");
            string         BaseMoney_One = DicBase["<1年"] + "";
            string         BaseMoney_two = DicBase[">1年"] + "";

            string SQL = @"select A.* ,
                            case 
                                when 1<datediff(year, Indutydate,getdate())and datediff(year,Indutydate,getdate())<5 then {0}  
                                when 5<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<10 then {1}   
                                when 10<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<15 then {2}   
                                when 15<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<20 then {3} 
                                else 0
                            end  As YearMoney,
                            case 
                                when  charindex('正式工',B.psnclassname)>0 and year(Indutydate)>1 then {5}
                               else {4}
                            end As BaseMoney ,C.GroupID as CorpId,C.Name As CorpName,D.GroupID As DeptId,D.Name As DeptName
                         from FL_PortalHR..sysuser  As A
                             left join HR_OA_MiddleDB..fld_rylb As B
                                on B.pk_fld_rylb=A.Pk_rylb 
                            left join FL_PortalHR..SysGroup As C
                                on C.GroupID=A.PK_Corp
                            left join FL_PortalHR..SysGroup As D
                                on D.GroupID=A.Pk_deptdoc
                         where 
                            (OutdutyDate='' or OutdutyDate is null) and A.Status=1 and A.Indutydate<>''  ##QUERY## ";

            SQL          = string.Format(SQL, One, Two, Three, Four, BaseMoney_One, BaseMoney_two);
            SQL          = SQL.Replace("FL_PortalHR", Global.AimPortalDB);
            SQL          = SQL.Replace("HR_OA_MiddleDB", Global.HR_OA_MiddleDB);
            SQL          = SQL.Replace("getdate()", limitDateStr);
            string where = string.Empty;
            CommPowerSplit PS = new CommPowerSplit();

            if (PS.IsAdmin(UserInfo.LoginName) || PS.IsHR(UserInfo.UserID, UserInfo.LoginName))
            {
            }
            else
            {
                where += " and A.Pk_corp='" + CorpId + "' ";
            }
            SQL = SQL.Replace("##QUERY##", where);

            DataTable UDt = DataHelper.QueryDataTable(SQL);

            for (int i = 0; i < UDt.Rows.Count; i++)
            {
                try
                {
                    TravelMoneyConfig TM = new TravelMoneyConfig();
                    string            YearMoney = UDt.Rows[i]["YearMoney"] + "", BaseMoney = UDt.Rows[i]["BaseMoney"] + "";
                    if (!string.IsNullOrEmpty(YearMoney))
                    {
                        decimal M = 0.0m;
                        if (decimal.TryParse(YearMoney, out M))
                        {
                            TM.Money = M;
                        }
                    }
                    else
                    {
                        TM.Money = 0;
                    }

                    //基本津贴
                    if (!string.IsNullOrEmpty(BaseMoney))
                    {
                        decimal M = 0.0m;
                        if (decimal.TryParse(BaseMoney, out M))
                        {
                            TM.BaseMoney = M;
                        }
                    }
                    else
                    {
                        TM.BaseMoney = 0;
                    }

                    TM.UserId   = UDt.Rows[i]["UserID"] + "";
                    TM.UserName = UDt.Rows[i]["Name"] + "";
                    TM.WorkNo   = UDt.Rows[i]["WorkNo"] + "";

                    DateTime DTime = new DateTime();
                    if (DateTime.TryParse(UDt.Rows[i]["Indutydate"] + "", out DTime))
                    {
                        TM.Indutydate = DTime;
                    }

                    TM.HaveUsed   = "N";
                    TM.Corp       = UDt.Rows[i]["CorpId"] + "";
                    TM.CorpName   = UDt.Rows[i]["CorpName"] + "";
                    TM.DeptId     = UDt.Rows[i]["DeptId"] + "";
                    TM.DeptName   = UDt.Rows[i]["DeptName"] + "";
                    TM.CreateTime = DateTime.Now;
                    TM.Ext1       = "C|" + CorpId + "_" + UserInfo.UserID + ""; //生成标志
                    TM.Create();
                }
                catch { }
            }
            this.PageState.Add("State", "1");
        }
コード例 #27
0
        /// <summary>
        /// Change the current user context.
        /// </summary>
        /// <param name="db">A valid <c ref="ProviderPortalentities"/> context.</param>
        /// <param name="context">The desired user context.</param>
        /// <param name="itemId">The related item ID.</param>
        /// <param name="force">When true, removes the record status check.</param>
        /// <returns>Whether the context change succeeded.</returns>
        public static bool SetUserContext(ProviderPortalEntities db, UserContextName context, int?itemId = null, bool force = false)
        {
            var currentContext = GetUserContext();

            if (currentContext.ContextName == context &&
                currentContext.ItemId == itemId)
            {
                return(true);
            }

            var  currentUserId = Permission.GetCurrentUserId();
            bool canViewAdmin  = Permission.HasPermission(false, true,
                                                          Permission.PermissionName.CanViewAdministratorHomePage);

            bool success = false;

            switch (context)
            {
            case UserContextName.DeletedProvider:
            case UserContextName.Provider:

                var provider = db.Providers.FirstOrDefault(x => x.ProviderId == itemId);
                if (provider == null)
                {
                    break;
                }
                bool canViewProvider = Permission.HasPermission(false, true,
                                                                Permission.PermissionName.CanViewProviderHomePage);
                // Success if an admin, associated provider user or organisation user with edit permission
                success = canViewProvider &&
                          (canViewAdmin ||
                           provider.AspNetUsers.Any(x => x.Id == currentUserId) ||
                           provider.OrganisationProviders.Any(
                               x =>
                               x.CanOrganisationEditProvider &&
                               x.IsAccepted &&
                               !x.IsRejected &&
                               x.Organisation.AspNetUsers.Any(y => y.Id == currentUserId)));
                context = force
                        ? context
                        : provider.RecordStatusId != (int)Constants.RecordStatus.Live
                            ? UserContextName.DeletedProvider
                            : UserContextName.Provider;

                break;

            case UserContextName.DeletedOrganisation:
            case UserContextName.Organisation:

                var organisation = db.Organisations.FirstOrDefault(x => x.OrganisationId == itemId);
                if (organisation == null)
                {
                    break;
                }
                bool canViewOrganisation = Permission.HasPermission(false, true,
                                                                    Permission.PermissionName.CanViewOrganisationHomePage);
                // Success if an admin or associated organisation user
                success = canViewOrganisation &&
                          (canViewAdmin || organisation.AspNetUsers.Any(x => x.Id == currentUserId));
                context = force
                        ? context
                        : organisation.RecordStatusId != (int)Constants.RecordStatus.Live
                            ? UserContextName.DeletedOrganisation
                            : UserContextName.Organisation;
                break;

            case UserContextName.Administration:

                // Success if admin
                success = canViewAdmin;
                break;
            }

            if (success)
            {
                var newContext = new UserContextInfo(context, itemId);
                SetSessionContext(newContext);
            }

            return(success);
        }
コード例 #28
0
        private void DefaultSelect()
        {
            string where = "";
            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!String.IsNullOrEmpty(item.Value.ToString()))
                {
                    switch (item.PropertyName)
                    {
                    case "WorkNo":
                        where += " and A." + item.PropertyName + " like '%" + item.Value + "%' ";
                        break;

                    default:
                        where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                        break;
                    }
                }
            }

            //权限过滤
            var Ent = SurveyQuestion.TryFind(SurveyId);

            if (Ent != null && Ent.IsFixed == "2")
            {
                CommPowerSplit PS = new CommPowerSplit();
                if (PS.IsInAdminsRole(UserInfo.UserID) || PS.IsAdmin(UserInfo.LoginName) || PS.IsHR(UserInfo.UserID, UserInfo.LoginName))
                {
                }
                else
                {
                    UserContextInfo UC = new UserContextInfo();
                    where += " and D.Pk_corp='" + UC.GetUserCurrentCorpId(UserInfo.UserID) + "' ";
                }
            }

            string sql = @" IF (OBJECT_ID('tempdb..#ST') IS NOT NULL)
                                    DROP TABLE tempdb..#ST;
                            select    
                                 A.*, B.SortIndex As P, C.SortIndex As S 
                                 into #ST
                            from  FL_Culture..SummarySurvey_detail As A 
                             left join FL_Culture..QuestionItem As B 
                                on B.Id=A.QuestionId and A.SurveyId=B.SurveyId
                             left join FL_Culture..QuestionAnswerItem As C 
                                on A.SurveyId=C.SurveyId and  A.QuestionItemId=C.Id
							 left join FL_PortalHR..SysUser As D
							    on  A.UserId=D.UserId
                            where  A.SurveyId='{0}' and  A.WorkNo is not null ##query##
                            order by A.UserId, P,S ";

            if (!string.IsNullOrEmpty(where))
            {
                sql = sql.Replace("##query##", where);
            }
            else
            {
                sql = sql.Replace("##query##", "");
            }
            sql = string.Format(sql, SurveyId);
            sql = sql.Replace("FL_PortalHR", Global.AimPortalDB);
            sql = sql.Replace("HR_OA_MiddleDB", Global.HR_OA_MiddleDB);
            this.PageState.Add("DataList", GetPageData(sql, SearchCriterion));
        }
コード例 #29
0
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            string SurveyId = this.RequestData.Get("surveyId") + "";

            string where = "";

            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (!String.IsNullOrEmpty(item.Value.ToString()))
                {
                    switch (item.PropertyName)
                    {
                    case "StartTime":
                        where += " and CreateTime>='" + item.Value + "' ";
                        break;

                    case "EndTime":
                        where += " and CreateTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' ";
                        break;

                    default:
                        where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                        break;
                    }
                }
            }

            //权限过滤
            CommPowerSplit PS = new CommPowerSplit();

            if (PS.IsHR(UserInfo.UserID, UserInfo.LoginName) || PS.IsAdmin(UserInfo.LoginName) || PS.IsInAdminsRole(UserInfo.UserID))
            {
            }
            else
            {
                UserContextInfo UC = new UserContextInfo();
                where += " and C.GroupId='" + UC.GetUserCurrentCorpId(UserInfo.UserID) + "' ";
            }

            string sql = @"select A.Id,A.SurveyId,A.SurveyName,A.WorkNo,A.SurveyedUserId,A.SurveyedUserName,A.CreateTime,
                            A.TotalScore,A.ScoreInfo,
                            B.WorkNo As WorkNo1 , C.GroupID As CropId ,C.Name As CropName,D.GroupID As DeptId,D.Name AS DeptName,
                            E.IsNoName
                           from FL_Culture..SurveyCommitHistory As A
                              left join  FL_PortalHR..SysUser As B 
                                on  A.SurveyedUserId=B.UserID  or A.WorkNo=B.WorkNo
	                          left join  FL_PortalHR..SysGroup As C
		                        on C.GroupID=B.Pk_corp
	                          left join FL_PortalHR..SysGroup As D
		                         on D.GroupID =B.Pk_deptdoc
                              left join FL_Culture..SurveyQuestion As E
                                 on A.SurveyId=E.Id 
                           where A.SurveyId='{0}' ";

            sql = sql.Replace("FL_PortalHR", Global.AimPortalDB);

            sql += where;
            sql  = string.Format(sql, SurveyId);

            //SearchCriterion.SetSearch("SurveyId", SurveyId);
            //ents = SurveyCommitHistory.FindAll(SearchCriterion);
            //this.PageState.Add("SurveyCommitHistoryList", ents);
            this.PageState.Add("DataList", GetPageData(sql, SearchCriterion));
        }
コード例 #30
0
 /// <summary>
 /// Sets the session context and any associated variables.
 /// </summary>
 /// <param name="context">The context.</param>
 private static void SetSessionContext(UserContextInfo context)
 {
     HttpContext.Current.Session[Constants.SessionFieldNames.UserContext] = context;
     // Set or clear session data related to quality
     QualityIndicator.SetSessionInformation(context);
 }