Example #1
0
        private void DoSelect()
        {
            //            string sql = @"select
            //                             SurveyedUserId as UserId,SurveryUserName as UserName,
            //                             C.GroupID as DeptId,C.Name As DeptName,D.IsNoName
            //                           from BJKY_IntegratedManage..SurveyCommitHistory As A
            //                            left join BJKY_Portal..SysUserGroup As B
            //                                on A.SurveyedUserId=B.UserId
            //                            left join BJKY_Portal..SysGroup As C
            //                                on C.GroupID=B.GroupID
            //                            left  join BJKY_IntegratedManage..SurveyQuestion AS D
            //	                            on D.Id=A.SurveyId
            //                           where A.SurveyId='{0}' and 1=1 ";
            string sql = @"select 
	                            SurveyedUserId as UserId,SurveryUserName as UserName,D.IsNoName,A.CreateTime
                           from BJKY_IntegratedManage..SurveyCommitHistory As A
                            left  join BJKY_IntegratedManage..SurveyQuestion AS D
	                            on D.Id=A.SurveyId				
                           where A.SurveyId='{0}' and 1=1";

            if (SearchCriterion.GetSearchValue("UserName") != null)
            {
                sql = sql.Replace("and 1=1", " and A.SurveryUserName like '%" + SearchCriterion.GetSearchValue("UserName") + "%'");
            }
            if (!string.IsNullOrEmpty(Id))
            {
                sql = string.Format(sql, Id);
                this.PageState.Add("DataList", GetPageData(sql, SearchCriterion));
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id    = RequestData.Get <string>("id", String.Empty);
            type  = RequestData.Get <string>("type", String.Empty).ToLower();
            ctype = RequestData.Get <string>("ctype", "user").ToLower();
            if (ctype == "group")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ICriterion cirt = null;

                    if (type == "gtype")
                    {
                        cirt = Expression.Sql("UserID IN (SELECT UserID FROM SysUserGroup WHERE GroupID IN (SELECT GroupID FROM SysGroup WHERE Type = ?))", id, NHibernateUtil.String);
                    }
                    else
                    {
                        // 应该同时获取子组用户 矿研的组织机构sysgroup path 字段中并不包含本记录的ID  所以下列语句要改写
                        //cirt = Expression.Sql("UserID IN (SELECT UserID FROM View_SysUserGroup WHERE Path LIKE '%" + id + "%' or GroupId='" + id + "')",
                        //    id, NHibernateUtil.String);
                        cirt = Expression.Sql("UserID IN (SELECT UserID FROM  SysUserGroup WHERE GroupID IN (SELECT GroupID FROM SysGroup where  Path LIKE '%" + id + "%' or GroupId='" + id + "'))",
                                              id, NHibernateUtil.String);
                    }
                    cirt = SearchHelper.IntersectCriterions(cirt, Expression.IsNull("Ext1"));
                    SearchCriterion.AutoOrder = false;
                    SearchCriterion.SetOrder(SysUser.Prop_WorkNo);
                    users = SysUserRule.FindAll(SearchCriterion, cirt);
                }
                PageState.Add("UsrList", users);
            }
            else
            {
                SearchCriterion.AutoOrder = false;
                string dName  = SearchCriterion.GetSearchValue <string>("Name");
                string workNo = SearchCriterion.GetSearchValue <string>("WorkNo");
                SearchCriterion.SetOrder(SysUser.Prop_WorkNo);
                if (dName != null && dName.Trim() != "")
                {
                    string where = "select * from SysUser where " + GetPinyinWhereString("Name", dName);
                    where       += "and Ext1 is null and WorkNo like '%" + workNo + "%'";
                    PageState.Add("UsrList", DataHelper.QueryDictList(where));
                }
                else
                {
                    ICriterion cirt = null;
                    cirt  = SearchHelper.IntersectCriterions(cirt, Expression.IsNull("Ext1"));
                    users = SysUserRule.FindAll(SearchCriterion, cirt);
                    PageState.Add("UsrList", users);
                }
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id    = RequestData.Get <string>("id", String.Empty);
            type  = RequestData.Get <string>("type", String.Empty).ToLower();
            ctype = RequestData.Get <string>("ctype", "user").ToLower();

            if (ctype == "group")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ICriterion cirt = null;

                    if (type == "gtype")
                    {
                        cirt = Expression.Sql("UserID IN (SELECT UserID FROM SysUserGroup WHERE GroupID IN (SELECT GroupID FROM SysGroup WHERE Type = ?))", id, NHibernateUtil.String);
                    }
                    else
                    {
                        // 应该同时获取子组用户
                        cirt = Expression.Sql("UserID IN (SELECT UserID FROM SysUserGroup WHERE GroupID IN (SELECT GroupID FROM SysGroup WHERE GroupID = ? OR Path LIKE '%" + id + "%'))",
                                              id, NHibernateUtil.String);
                    }
                    SearchCriterion.AutoOrder = false;
                    SearchCriterion.SetOrder(SysUser.Prop_WorkNo);
                    users = SysUserRule.FindAll(SearchCriterion, cirt);
                    this.PageState.Add("UsrList", users);
                }
            }
            else
            {
                SearchCriterion.AutoOrder = false;

                string dName  = SearchCriterion.GetSearchValue <string>("Name");
                string workNo = SearchCriterion.GetSearchValue <string>("WorkNo");
                SearchCriterion.SetOrder(SysUser.Prop_WorkNo);
                if (dName != null && dName.Trim() != "")
                {
                    string where = "select * from SysUser where " + GetPinyinWhereString("Name", dName);
                    where       += " and WorkNo like '%" + workNo + "%'";
                    this.PageState.Add("UsrList", DataHelper.QueryDictList(where));
                }
                else
                {
                    users = SysUserRule.FindAll(SearchCriterion);
                    this.PageState.Add("UsrList", users);
                }
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SearchCriterion.AutoOrder = false;
            SearchCriterion.SetOrder(SysUser.Prop_WorkNo);
            string dName = SearchCriterion.GetSearchValue <string>("Name");

            if (dName != null && dName.Trim() != "")
            {
                string where = "select * from SysUser where " + GetPinyinWhereString("Name", dName);
                this.PageState.Add("UsrList", DataHelper.QueryDictList(where));
            }
            else
            {
                ents = SysUserRule.FindAll(SearchCriterion);
                this.PageState.Add("UsrList", ents);
            }
            if (this.IsAsyncRequest)
            {
                switch (this.RequestAction)
                {
                case RequestActionEnum.Custom:
                    if (RequestActionString == "querychildren")
                    {
                        string id    = (RequestData.ContainsKey("ID") ? RequestData["ID"].ToString() : String.Empty);
                        string ttype = RequestData["Type"].ToString().ToLower();

                        if (RequestData.ContainsKey("Type"))
                        {
                            if (ttype == "atype")      // 1为入口权限
                            {
                                SysAuth[] auths = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.Type = ?", id);

                                this.PageState.Add("DtList", auths);
                            }
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            else
            {
                SysAuthType[] authTypeList = SysAuthTypeRule.FindAll();
                this.PageState.Add("DtList", authTypeList);
            }
        }
Example #5
0
        private void DoSelect()
        {
            string dName = SearchCriterion.GetSearchValue <string>("Name");

            string where = "";
            if (dName != null && dName.Trim() != "")
            {
                where = "and " + GetPinyinWhereString("B.Name", dName);
            }
            string sql = @"select A.UserId as UserId,A.GroupId as GroupId,B.Name,B.WorkNo,C.Name as GroupName 
            from BJKY_Portal..SysUserGroup as A 
            left join BJKY_Portal..SysUser as B on B.UserId=A.UserId 
            left join BJKY_Portal..SysGroup as C on A.GroupId=C.GroupId where PatIndex('%{0}%',C.Path)>0 " + where;

            PageState.Add("UsrList", GetPageData(string.Format(sql, id), SearchCriterion));
        }
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            string sql = @"select * from SysUser where UserID in (
select UserID from (
select count(UserID)%2 cnt,UserID from SysEvent where DateTime>=dateadd(day,-2,GetDate()) and Type is null
 group by UserID) a 
where cnt>0)";

            if (SearchCriterion.GetSearchValue <string>("Name") != "")
            {
                sql += " and Name like '%" + SearchCriterion.GetSearchValue <string>("Name") + "%'";
            }
            //PageState.Add("AbsenceApplyList", GetPageData(sql, SearchCriterion));
            //ents = AbsenceApply.FindAll(SearchCriterion);
            //this.PageState.Add("AbsenceApplyList", ents);
            Aim.Portal.ServicesProvider.WebPortalServiceProvider ws = (Aim.Portal.ServicesProvider.WebPortalServiceProvider)WebPortalService.GetDefaultProvider();
            SysUser[] users = Aim.Common.ServiceHelper.DeserializeFromBytes <SysUser[]>(ws.USService.GetSystemData("<container><parameters><parameter Name='SessionID'></parameter><parameter Name='Operation'>getonlineusers</parameter></parameters></container>"));
            PageState.Add("AbsenceApplyList", users);
        }
        /// <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);
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Request.Files.Count > 0)
            {
                string guid     = Guid.NewGuid().ToString();
                string filePath = "//WorkTime//InputExcelFiles//" + Guid.NewGuid().ToString() + System.IO.Path.GetExtension(Request.Files[0].FileName);
                this.Request.Files[0].SaveAs(Server.MapPath(filePath));
                ExcelProcessor ep = ExcelService.GetProcessor(Server.MapPath(filePath));
                DataSet        ds = ep.GetDataSet();
                InputDatas(ds.Tables[0]);
                Response.Write("{success:true}");
                Response.End();
            }

            id   = RequestData.Get <string>("id", String.Empty);
            type = RequestData.Get <string>("type", String.Empty);

            SysUser usr = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Create:
                usr = this.GetPostedData <SysUser>();
                usr.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Update:
                usr = this.GetMergedData <SysUser>();
                usr.DoUpdate();
                this.SetMessage("保存成功!");
                break;

            case RequestActionEnum.Delete:
                usr = this.GetTargetData <SysUser>();
                usr.DoDelete();
                this.SetMessage("删除成功!");
                break;

            default:
                if (RequestActionString == "clearpass")
                {
                    usr          = SysUser.Find(this.RequestData.Get <string>("UserId"));
                    usr.Password = "";
                    usr.Remark   = "";
                    usr.Save();
                }
                else if (RequestActionString == "setpass")
                {
                    MD5Encrypt encrypt = new MD5Encrypt();
                    SysUser[]  users   = SysUser.FindAll();
                    foreach (SysUser user in users)
                    {
                        Random rnd           = new Random();
                        int    rndNum        = rnd.Next(10000000, 99999999);
                        string encryPassword = encrypt.GetMD5FromString(rndNum.ToString());
                        user.Password = encryPassword;
                        user.Remark   = rndNum.ToString();
                        user.Save();
                    }
                }
                else if (RequestActionString == "checkkey")
                {
                    if (SysUser.FindAllByProperties("Server_IAGUID", this.RequestData.Get <string>("usbguid")).Length > 0)
                    {
                        this.PageState.Add("UserName", SysUser.FindAllByProperties("Server_IAGUID", this.RequestData.Get <string>("usbguid"))[0].Name);
                    }
                    else
                    {
                        this.PageState.Add("UserName", "");
                    }
                }
                else if (RequestActionString == "setkey")
                {
                    SysUser user = SysUser.Find(this.RequestData.Get <string>("userid"));
                    user.Server_IAGUID = this.RequestData.Get <string>("usbguid");
                    user.Server_Seed   = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
                    user.ThreeDESKEY   = "ABCDEFGhijklmn0123456789";
                    user.Save();
                }
                else if (RequestActionString == "sendmail")
                {
                    IList <object> idList = RequestData.GetList <object>("IdList");
                    SysUser[]      tents  = SysUser.FindAll(Expression.In("UserID", idList.ToArray()));

                    foreach (SysUser user in tents)
                    {
                        string body = SysParameter.FindAllByProperties("Code", "MailText")[0].Description + "<br>";
                        body += "您的登录用户名:" + user.LoginName + ";密码:" + user.Remark;
                        string mailAccount       = SysParameter.FindAllByProperties("Code", "MailAccount")[0].Value;
                        string mailPass          = SysParameter.FindAllByProperties("Code", "MailPassword")[0].Value;
                        string mailServer        = SysParameter.FindAllByProperties("Code", "MailSmtpServer")[0].Value;
                        string mailSenderAddress = SysParameter.FindAllByProperties("Code", "MailSenderAddress")[0].Value;
                        MailHelper.SendMail(mailSenderAddress, user.Email, "工时分配系统邮件", body, mailAccount, mailPass, mailServer);
                    }
                }
                else
                {
                    SearchCriterion.AutoOrder = false;
                    SearchCriterion.SetOrder(SysUser.Prop_WorkNo);
                    string dName  = SearchCriterion.GetSearchValue <string>("Name");
                    string workNo = SearchCriterion.GetSearchValue <string>("WorkNo");
                    SearchCriterion.SetOrder(SysUser.Prop_WorkNo);
                    if (dName != null && dName.Trim() != "")
                    {
                        string where = "select * from SysUser where " + GetPinyinWhereString("Name", dName);
                        where       += " and WorkNo like '%" + workNo + "%'";
                        this.PageState.Add("UsrList", DataHelper.QueryDictList(where));
                    }
                    else
                    {
                        users = SysUserRule.FindAll(SearchCriterion);
                        this.PageState.Add("UsrList", users);
                    }
                }
                break;
            }
        }
Example #9
0

        
Example #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Request.Files.Count > 0)
            {
                string guid     = Guid.NewGuid().ToString();
                string filePath = "//WorkTime//InputExcelFiles//" + Guid.NewGuid().ToString() + System.IO.Path.GetExtension(Request.Files[0].FileName);
                this.Request.Files[0].SaveAs(Server.MapPath(filePath));
                ExcelProcessor ep        = ExcelService.GetProcessor(Server.MapPath(filePath));
                DataSet        ds        = ep.GetDataSet();
                string         exMessage = "";
                workNumbers = "";
                try
                {
                    InputDatasV2(ds.Tables[0]);
                }
                catch (Exception ex)
                {
                    exMessage = ex.Message;
                }
                if (workNumbers != "")
                {
                    Response.Write("{success:false,message:'" + workNumbers + "'}");
                    Response.End();
                }
                else
                {
                    Response.Write("{success:true}");
                    Response.End();
                }
            }

            id   = RequestData.Get <string>("id", String.Empty);
            type = RequestData.Get <string>("type", String.Empty);

            SysUser usr = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Create:
                usr = this.GetPostedData <SysUser>();
                usr.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Update:
                usr = this.GetMergedData <SysUser>();
                usr.DoUpdate();
                this.SetMessage("保存成功!");
                break;

            case RequestActionEnum.Delete:
                usr = this.GetTargetData <SysUser>();
                usr.DoDelete();
                this.SetMessage("删除成功!");
                break;

            default:
                if (RequestActionString == "clearpass")
                {
                    usr          = SysUser.Find(this.RequestData.Get <string>("UserId"));
                    usr.Password = "";
                    usr.Save();
                }
                else
                {
                    SearchCriterion.AutoOrder = false;
                    SearchCriterion.SetOrder(SysUser.Prop_WorkNo);
                    string dName = SearchCriterion.GetSearchValue <string>("Name");
                    if (dName != null && dName.Trim() != "")
                    {
                        string where = "select * from SysUser where " + GetPinyinWhereString("Name", dName);
                        this.PageState.Add("UsrList", DataHelper.QueryDictList(where));
                    }
                    else
                    {
                        users = SysUserRule.FindAll(SearchCriterion);

                        this.PageState.Add("UsrList", users);
                    }
                }
                break;
            }
        }