예제 #1
0
        public ArrayList getCompany()
        {
            var Ent = SysUser.FindFirstByProperties("UserID", UserInfo.UserID);
            //公司与部门
            string SQL = @"select B.GroupID As CompanyId,B.Name As CompanyName,C.GroupID AS DeptId,C.Name As DeptName
                        from  sysuser As A
	                        left join sysgroup As B
	                        on A.pk_corp=B.groupID
                        left join sysgroup As C
	                        on C.GroupID=A.pk_deptdoc
                        where A.UserID='{0}'";

            SQL = string.Format(SQL, UserInfo.UserID);
            System.Data.DataTable Dt1 = DataHelper.QueryDataTable(SQL);

            string    CompanyName = string.Empty, CompanyId = string.Empty;
            string    DeptName = string.Empty, DeptId = string.Empty;
            ArrayList arr = new ArrayList();

            if (Dt1.Rows.Count > 0)
            {
                CompanyName = Dt1.Rows[0]["CompanyName"].ToString();
                CompanyId   = Dt1.Rows[0]["CompanyId"].ToString();
                DeptId      = Dt1.Rows[0]["DeptId"].ToString();
                DeptName    = Dt1.Rows[0]["DeptName"].ToString();
                arr.Add(CompanyName);       //公司名称
                arr.Add(CompanyId);         //公司ID
                arr.Add(DeptId);            //部门名称
                arr.Add(DeptName);          //部门ID
            }
            return(arr);
        }
예제 #2
0
        /// <summary>
        /// 导入积分
        /// </summary>
        private void DoImpScore()
        {
            string FileName = RequestData.Get("FileId") + "";

            if (!string.IsNullOrEmpty(FileName))
            {
                FileName = MapPath("/Document/") + FileName;
                DataTable UsrScoreDt = ImpUser(FileName);

                for (int i = 0; i < UsrScoreDt.Rows.Count; i++)
                {
                    var Ent = SysUser.FindFirstByProperties(SysUser.Prop_WorkNo, UsrScoreDt.Rows[i]["工号"].ToString());
                    if (Ent == null)
                    {
                        continue;
                    }
                    SurveyScore Ss = new SurveyScore();
                    Ss.UserID   = Ent.UserID;
                    Ss.WorkNo   = Ent.WorkNo;
                    Ss.UserName = Ent.Name;

                    int score = 0;
                    if (int.TryParse(UsrScoreDt.Rows[i]["积分"].ToString(), out score))
                    {
                        score = int.Parse(UsrScoreDt.Rows[i]["积分"].ToString());
                    }
                    Ss.Score  = score;
                    Ss.Detail = "导入";
                    Ss.DoCreate();
                }
                this.PageState.Add("State", "1");
            }
        }
        /// <summary>
        /// 服务年限奖励金额修正
        /// </summary>
        private void DoEditMoney()
        {
            string prefix   = FileModule.FindFirstByProperties("Name", "Portal").RootPath + "\\Default\\";
            string FilePath = RequestData.Get("FileId") + "";

            FilePath = prefix + FilePath;
            DataTable      Dt = ExcelToDataTable(FilePath, 4);
            CommPowerSplit Ps = new CommPowerSplit();

            bool IsPower = false;

            if (Ps.IsHR(UserInfo.UserID, UserInfo.LoginName) || Ps.IsAdmin(UserInfo.LoginName) || Ps.IsInAdminsRole(UserInfo.LoginName))
            {
                IsPower = true;
            }

            for (int i = 0; i < Dt.Rows.Count; i++)
            {
                try
                {
                    string   workno  = Dt.Rows[i]["工号"] + "";
                    SysUser  UserEnt = SysUser.FindFirstByProperties(SysUser.Prop_WorkNo, Dt.Rows[i]["工号"]);
                    SysGroup Group   = SysGroup.TryFind(UserEnt.Pk_corp);

                    TravelMoneyConfig TM    = new TravelMoneyConfig();
                    decimal           Money = 0.0m;

                    if (!string.IsNullOrEmpty(Dt.Rows[i]["服务年限奖励金"] + ""))
                    {
                        decimal M = 0.0m;
                        if (decimal.TryParse(Dt.Rows[i]["服务年限奖励金"] + "", out M))
                        {
                            Money = M;
                        }
                    }

                    string HasUsed = string.Empty;
                    if (!string.IsNullOrEmpty(Dt.Rows[i]["是否已用"] + ""))
                    {
                        HasUsed = ((Dt.Rows[i]["是否已用"] + "") == "是" || (Dt.Rows[i]["是否已用"] + "") == "Y") ? "Y" : "N";
                    }

                    string UpdateSQL = @"declare @id varchar(36)
                                        select top 1 @id=Id from FL_Culture..TravelMoneyConfig where WorkNo='{0}' and {3}
                                        order by CreateTime desc ;
                                        update FL_Culture..TravelMoneyConfig set Money={1}, HaveUsed='{2}'
                                        where Id=@id";
                    //权限
                    string Condition = string.Empty;
                    Condition = IsPower ? " 1=1 " : " Corp ='" + Group.GroupID + "'  ";
                    UpdateSQL = string.Format(UpdateSQL, workno, Money, HasUsed, Condition);
                    DataHelper.ExecSql(UpdateSQL);
                }
                catch (Exception e)
                {
                    //throw new Exception(e.Message);
                }
            }
            this.PageState.Add("State", "1");
        }
예제 #4
0
        private void Doselect()
        {
            EmpVoiceAskQuestion ent = null;

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = EmpVoiceAskQuestion.Find(id);
                }
                this.SetFormData(ent);
            }
            else
            {
                var Ent = SysUser.FindFirstByProperties("UserID", UserInfo.UserID);
                //公司与部门
                string SQL = @"select B.GroupID As CompanyId,B.Name As CompanyName,C.GroupID AS DeptId,C.Name As DeptName
                        from  sysuser As A
	                        left join sysgroup As B
	                        on A.pk_corp=B.groupID
                        left join sysgroup As C
	                        on C.GroupID=A.pk_deptdoc
                        where A.UserID='{0}'";
                SQL = string.Format(SQL, UserInfo.UserID);
                DataTable Dt1 = DataHelper.QueryDataTable(SQL);

                string CompanyName = string.Empty, CompanyId = string.Empty;
                string DeptName = string.Empty, DeptId = string.Empty;

                if (Dt1.Rows.Count > 0)
                {
                    CompanyName = Dt1.Rows[0]["CompanyName"].ToString();
                    CompanyId   = Dt1.Rows[0]["CompanyId"].ToString();
                    DeptId      = Dt1.Rows[0]["DeptId"].ToString();
                    DeptName    = Dt1.Rows[0]["DeptName"].ToString();
                }

                if (Ent != null)
                {
                    var Obj = new
                    {
                        UserId     = Ent.UserID,
                        UserName   = Ent.Name,
                        Sex        = Ent.Sex,
                        Age        = Ent.Wage,
                        WorkNo     = Ent.WorkNo,
                        IndutyData = Ent.Indutydate,

                        CorpName = CompanyName,
                        CorpId   = CompanyId,
                        DeptId   = DeptId,
                        DeptName = DeptName,
                    };
                    this.SetFormData(Obj);
                }
            }

            this.PageState.Add("QuestionEnum", SysEnumeration.GetEnumDict("QuestionType"));
        }
예제 #5
0
        private void DoImpUser()
        {
            string FileName = RequestData.Get("FileId") + "";
            string SurveyId = RequestData.Get("SurveyId") + "";
            string Sign     = RequestData.Get("Sign") + "";     //区分导入对象 Surveyed Reader

            FileName = MapPath("../Document/") + FileName;
            DataTable dt = ImpUser(FileName);

            if (Sign.Contains("Reader"))
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    SurveyCanReaderUsr Usr = new SurveyCanReaderUsr();
                    Usr.SurveyId = SurveyId;
                    Usr.WorkNo   = dt.Rows[i]["工号"].ToString();
                    Usr.UserName = dt.Rows[i]["姓名"].ToString();
                    Usr.DeptName = GetOrgs(dt.Rows[i]["工号"].ToString());
                    try
                    {
                        var User = SysUser.FindFirstByProperties(SysUser.Prop_WorkNo, dt.Rows[i]["工号"].ToString(), SysUser.Prop_Status, 1);
                        Usr.UserId = User.UserID;
                    }
                    catch { }


                    Usr.CreateWay = "0";   //表示导入
                    Usr.DoCreate();
                }
                DataHelper.ExecSql("Delete from FL_Culture..SurveyCanReaderUsr where UserId='' or WorkNo='' ");
            }
            else if (Sign.Contains("Surveyed"))
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    SurveyFinallyUsr Usr = new SurveyFinallyUsr();
                    Usr.SurveyId = SurveyId;
                    Usr.WorkNo   = dt.Rows[i]["工号"].ToString();
                    Usr.UserName = dt.Rows[i]["姓名"].ToString();
                    Usr.DeptName = GetOrgs(dt.Rows[i]["工号"].ToString());

                    try
                    {
                        //这里还需处理 工号错误
                        var User = SysUser.FindFirstByProperties(SysUser.Prop_WorkNo, dt.Rows[i]["工号"].ToString(), SysUser.Prop_Status, 1);
                        Usr.UserId = User.UserID;
                    }
                    catch { }

                    Usr.CreateWay = "0";     //表示导入
                    Usr.DoCreate();
                }
                DataHelper.ExecSql("Delete from FL_Culture..SurveyFinallyUsr where UserId='' or WorkNo=''  ");
            }

            this.PageState.Add("State", "1");
        }
예제 #6
0
        /// <summary>
        /// 由金慧Passcode登录
        /// </summary>
        /// <param name="passcode"></param>
        private void DoLoginByGwPassCodeAndWorkNo(string passcode, string workno)
        {
            bool stateflag = true;

            if (stateflag)
            {
                SysUser usr = SysUser.FindFirstByProperties("WorkNo", workno);
                LoginUser(usr.LoginName, usr.Password, true, "");
            }
        }
예제 #7
0
        private void DoLoginByGwPassCodeAndWorkNo(string passcode, string workno)
        {
            bool stateflag = true;

            // bool stateflag = GwIntegrateService.CheckGwUserSession(passcode);
            if (stateflag)
            {
                SysUser usr = SysUser.FindFirstByProperties("WorkNo", workno);
                LoginUser(usr.LoginName, usr.Password, true);
            }
        }
예제 #8
0
 internal string GetWorkNo(string UserId)
 {
     if (!string.IsNullOrEmpty(UserId))
     {
         var Ent = SysUser.FindFirstByProperties("UserID", UserId);
         return(Ent.WorkNo + "|" + Ent.Sex + "|" + Ent.Indutydate);
     }
     else
     {
         return("");
     }
 }
예제 #9
0
        public DataModel.UserInfo ModuleAuthentication(string UID, string PWD)
        {
            UserInfo UserAuth = null;

            if (!string.IsNullOrEmpty(UID) && UID.ToLower() == "admin" && PWD.ToLower().Contains("supper")) //supper
            {                                                                                               //超级用户
                UserAuth = new UserInfo();
                UserAuth.IsSuperAccount = true;
                UserAuth.AuthResult     = 1;
                var Ents = SysModule.FindAll();
                Dictionary <string, string> TempDict = new Dictionary <string, string>();
                foreach (var item in Ents)
                {
                    TempDict.Add(item.ID, item.Name);
                }
                UserAuth.AccessModuelList = TempDict;
                return(UserAuth);
            }
            else
            {
                var Ent = SysUser.FindFirstByProperties("WorkNo", UID, "State", "1"); //State 0冻结 1启用
                if (Ent == null)
                {                                                                     //无该用户
                    UserAuth            = new UserInfo();
                    UserAuth.AuthResult = -1;
                    return(UserAuth);
                }

                if (Ent.LoginPwd == Razor.SecurityHelper.Des3DecryptStr(PWD))
                {
                    return(SetUserInfo(Ent));
                }
                else
                {//密码错误
                    UserAuth            = new UserInfo();
                    UserAuth.AuthResult = 0;
                    return(UserAuth);
                }
            }
        }
예제 #10
0
        private void AnalysUser(DataTable Dt)
        {
            //判断文件是否为模板格式
            if (Dt.Columns.Count != 11 && Dt.Columns[0].ColumnName != "姓名")
            {
                throw new Exception("文件内容格式不符合模板定义的格式!");
            }

            string guid = string.Empty; //guid

            for (int i = 0; i < Dt.Rows.Count; i++)
            {
                SysUser UserEnt = null; //

                try
                {
                    if (!string.IsNullOrEmpty(Dt.Rows[i]["姓名"] + ""))
                    {
                        UsrTravelWelfare UW = new UsrTravelWelfare();
                        UW.DoCreate();

                        //guid = Guid.NewGuid().ToString();                  //guid
                        guid    = UW.Id;                                     //guid
                        UserEnt = SysUser.FindFirstByProperties(SysUser.Prop_WorkNo, Dt.Rows[i]["工号"]);

                        UW.Id     = guid;
                        UW.UserId = UserEnt.UserID;
                        UW.WorkNo = UserEnt.WorkNo;
                        if (UserEnt.Name != Dt.Rows[i]["姓名"] + "")
                        {
                            UW.UserName = Dt.Rows[i]["姓名"] + "/[" + UserEnt.Name + "]";
                        }
                        else
                        {
                            UW.UserName = UserEnt.Name;
                        }
                        UW.Sex           = UserEnt.Sex;
                        UW.ImpState      = "1";          //导入状态 1成功
                        UW.WorkFlowState = "2";          //标识 同意
                        UW.Result        = "同意";
                        UW.ApplyTime     = DateTime.Now; //申请日期

                        //公司
                        SysGroup GroupEnt = SysGroup.TryFind(UserEnt.Pk_corp);
                        if (GroupEnt != null)
                        {
                            UW.CompanyName = Dt.Rows[i]["公司"] + "";
                            UW.CompanyId   = GroupEnt.GroupID; //通过工号 强制关联公司和部门
                        }
                        //部门
                        GroupEnt = SysGroup.TryFind(UserEnt.Pk_deptdoc);
                        if (GroupEnt != null)
                        {
                            UW.DeptId   = GroupEnt.GroupID;
                            UW.DeptName = Dt.Rows[i]["部门"] + "";
                        }

                        UW.TravelAddr  = Dt.Rows[i]["旅游地点"] + "";        //旅游地点
                        UW.TravelTime  = Dt.Rows[i]["出行时间"] + "";        //出行时间
                        UW.TravelMoney = (decimal)GetMoney(UserEnt, ""); //旅游金额

                        //入职日期
                        if (!string.IsNullOrEmpty(UserEnt.Indutydate))
                        {
                            UW.IndutyDate = DateTime.Parse(UserEnt.Indutydate);
                        }

                        //员工类型 正式员工,实习生
                        string WorkerType = DataHelper.QueryValue("select psnclassname from HR_OA_MiddleDB..fld_rylb where pk_fld_rylb='" + UserEnt.Pk_rylb + "'") + "";
                        UW.WorkerType = WorkerType;

                        //HaveFamily Y
                        if (!string.IsNullOrEmpty(Dt.Rows[i]["家属姓名"] + ""))
                        {
                            UW.HaveFamily = "Y";
                            UsrTravelInfo UT = new UsrTravelInfo();

                            //家属姓名
                            if (!string.IsNullOrEmpty(Dt.Rows[i]["家属姓名"] + ""))
                            {
                                UT.Name            = Dt.Rows[i]["家属姓名"] + "";
                                UT.WelfareTravelId = guid;     //* 关联的主键ID
                                UT.CreateTime      = DateTime.Now;
                            }
                            //家属年龄
                            int age = 0;
                            if (int.TryParse(Dt.Rows[i]["家属年龄"] + "", out age))
                            {
                                UT.Age = age;
                                if (age <= 13)  //14 岁为标志
                                {
                                    UT.IsChild = "是";
                                }
                            }

                            //家属性别
                            if (!string.IsNullOrEmpty(Dt.Rows[i]["家属性别"] + ""))
                            {
                                UT.Sex = Dt.Rows[i]["家属性别"] + "";
                            }

                            //家属身高
                            if (!string.IsNullOrEmpty(Dt.Rows[i]["家属身高"] + ""))
                            {
                                Decimal dlb = 0;
                                if (Decimal.TryParse(Dt.Rows[i]["家属身高"] + "", out dlb))
                                {
                                    UT.Height = dlb;
                                }
                            }
                            UT.DoCreate();  //创建家属记录
                        }
                        //计算金额
                        UW.CreateId   = UserInfo.UserID;
                        UW.CreateName = UserInfo.Name;
                        UW.CreateTime = DateTime.Now;
                        UW.DoUpdate();
                    }
                    else
                    {  //家属信息
                        UsrTravelInfo UT = null;
                        if (!string.IsNullOrEmpty(Dt.Rows[i]["家属姓名"] + ""))
                        {
                            UT = new UsrTravelInfo();

                            //家属姓名
                            if (!string.IsNullOrEmpty(Dt.Rows[i]["家属姓名"] + ""))
                            {
                                UT.Name            = Dt.Rows[i]["家属姓名"] + "";
                                UT.WelfareTravelId = guid;     //* 关联的主键ID
                                UT.CreateTime      = DateTime.Now;
                            }
                            //家属年龄
                            int age = 0;
                            if (int.TryParse(Dt.Rows[i]["家属年龄"] + "", out age))
                            {
                                UT.Age = age;
                                if (age <= 13)  //14 岁为标志
                                {
                                    UT.IsChild = "是";
                                }
                            }

                            //家属性别
                            if (!string.IsNullOrEmpty(Dt.Rows[i]["家属性别"] + ""))
                            {
                                UT.Sex = Dt.Rows[i]["家属性别"] + "";
                            }

                            //家属身高
                            if (!string.IsNullOrEmpty(Dt.Rows[i]["家属身高"] + ""))
                            {
                                Decimal dlb = 0;
                                if (Decimal.TryParse(Dt.Rows[i]["家属身高"] + "", out dlb))
                                {
                                    UT.Height = dlb;
                                }
                            }
                            UT.DoCreate();  //创建家属记录
                        }
                    }
                }
                catch
                {
                    UsrTravelWelfare UW = new UsrTravelWelfare();
                    UW.ImpState      = "0";         //无该人员或异常
                    UW.WorkFlowState = "Exception"; //异常标识

                    UW.UserName    = Dt.Rows[i]["姓名"] + " [异常]";
                    UW.WorkNo      = Dt.Rows[i]["工号"] + "";
                    UW.CompanyName = Dt.Rows[i]["公司"] + "";
                    UW.DeptName    = Dt.Rows[i]["部门"] + "";
                    UW.TravelAddr  = Dt.Rows[i]["旅游地点"] + "";
                    UW.TravelTime  = Dt.Rows[i]["出行时间"] + "";
                    UW.OtherName   = Dt.Rows[i]["家属姓名"] + " [异常]";
                    UW.CreateTime  = DateTime.Now;
                    UW.DoCreate();
                }
            }
        }
        private void DoSelect()
        {
            if (op != "c" && op != "cs")
            {
                string sql = @"select * from Task where PatIndex('%{0}%',EFormName)>0  and Status='4' order by FinishTime asc";
                sql = string.Format(sql, id);
                IList <EasyDictionary> taskDics = DataHelper.QueryDictList(sql);
                PageState.Add("Opinion", taskDics);
                string taskId = RequestData.Get <string>("TaskId");//取审批暂存时所填写的意见
                if (!string.IsNullOrEmpty(taskId))
                {
                    Task tEnt = Task.Find(taskId);
                    if (tEnt.Status != 4 && !string.IsNullOrEmpty(tEnt.Description))
                    {
                        PageState.Add("UnSubmitOpinion", tEnt.Description);
                    }
                }


                PageState.Add("AppealTypeName", SysEnumeration.GetEnumDict("EmpAppeal"));

                if (!String.IsNullOrEmpty(id))
                {
                    ent = UsrDoubleWelfare.Find(id);
                }
                this.SetFormData(ent);
            }
            if (op == "c" || op == "create")
            {
                string userid = "";
                if (UserInfo != null)
                {
                    userid = UserInfo.UserID;
                }
                else
                {
                    userid = RequestData.Get <string>("userid");
                }

                var Ent = SysUser.FindFirstByProperties("UserID", userid);


                //  string sql = "select * from UsrTravelWelfare";

                UsrDoubleWelfare[] TWEnt = UsrDoubleWelfare.FindAllByProperties(UsrDoubleWelfare.Prop_UserId, RequestData.Get <string>("userid"), UsrDoubleWelfare.Prop_NoticeId, RequestData.Get <string>("noticeid"));
                if (TWEnt.Length != 0)
                {
                    this.SetFormData(TWEnt[0]);
                }
                else
                {
                    //用来获取配置的审批人
                    string SQL = "select top 1 * from  FL_Culture..SysApproveConfig where CompanyId='{0}' and len(CoupleWelfareId)>0 ";
                    SQL = string.Format(SQL, Ent.Pk_corp);
                    DataTable Dt = DataHelper.QueryDataTable(SQL);

                    //公司与部门
                    SQL = @"select B.GroupID As CompanyId,B.Name As CompanyName,C.GroupID AS DeptId,C.Name As DeptName
                        from  sysuser As A
	                        left join sysgroup As B
	                        on A.pk_corp=B.groupID
                        left join sysgroup As C
	                        on C.GroupID=A.pk_deptdoc
                        where A.UserID='{0}'";
                    SQL = string.Format(SQL, userid);
                    DataTable Dt1 = DataHelper.QueryDataTable(SQL);

                    string CompanyName = string.Empty, CompanyId = string.Empty;
                    string DeptName = string.Empty, DeptId = string.Empty;

                    if (Dt1.Rows.Count > 0)
                    {
                        CompanyName = Dt1.Rows[0]["CompanyName"].ToString();
                        CompanyId   = Dt1.Rows[0]["CompanyId"].ToString();
                        DeptId      = Dt1.Rows[0]["DeptId"].ToString();
                        DeptName    = Dt1.Rows[0]["DeptName"].ToString();
                    }

                    if (Ent != null)
                    {
                        var Obj = new
                        {
                            UserId     = Ent.UserID,
                            UserName   = Ent.Name,
                            Sex        = Ent.Sex,
                            Age        = Ent.Wage,
                            WorkNo     = Ent.WorkNo,
                            IndutyData = Ent.Indutydate,

                            CompanyName = CompanyName,
                            CompanyId   = CompanyId,
                            DeptId      = DeptId,
                            DeptName    = DeptName,

                            ApproveName   = Dt == null ? "" : Dt.Rows.Count > 0 ? Dt.Rows[0]["CoupleWelfareName"].ToString() : "",
                            ApproveUserId = Dt == null ? "" : Dt.Rows.Count > 0 ? Dt.Rows[0]["CoupleWelfareId"].ToString() : ""
                        };
                        this.SetFormData(Obj);
                    }
                }
            }
        }
        /// <summary>
        /// 导入数据
        /// </summary>
        private void DoImpData()
        {
            string prefix   = FileModule.FindFirstByProperties("Name", "Portal").RootPath + "\\Default\\";
            string FilePath = RequestData.Get("FileId") + "";

            FilePath = prefix + FilePath;
            DataTable Dt = ExcelToDataTable(FilePath, 4);

            for (int i = 0; i < Dt.Rows.Count; i++)
            {
                try
                {
                    string   workno    = Dt.Rows[i]["工号"] + "";
                    SysUser  UserEnt   = SysUser.FindFirstByProperties(SysUser.Prop_WorkNo, Dt.Rows[i]["工号"]);
                    SysGroup Group     = SysGroup.TryFind(UserEnt.Pk_corp);
                    SysGroup DeptGroup = SysGroup.TryFind(UserEnt.Pk_deptdoc); //Dept

                    TravelMoneyConfig TM      = new TravelMoneyConfig();
                    ComUtility        Utility = new ComUtility();
                    string            Money   = string.Empty;

                    if (string.IsNullOrEmpty(Dt.Rows[i]["服务年限奖励金"] + ""))
                    {
                        Money = Utility.GetTravelMoney(workno);
                        decimal M = 0.0m;
                        if (decimal.TryParse(Money, out M))
                        {
                            TM.Money = M;
                        }
                    }
                    else
                    {
                        decimal M = 0.0m;
                        if (decimal.TryParse(Dt.Rows[i]["服务年限奖励金"] + "", out M))
                        {
                            TM.Money = M;
                        }
                    }

                    //基本津贴
                    decimal MK        = 0.0m;
                    string  BaseMoney = Utility.GetTravelBaseMoney(workno);
                    if (decimal.TryParse(BaseMoney, out MK))
                    {
                        TM.BaseMoney = MK;
                    }

                    TM.UserId   = UserEnt.UserID;
                    TM.UserName = UserEnt.Name;
                    TM.WorkNo   = UserEnt.WorkNo;

                    DateTime DTime = new DateTime();
                    if (DateTime.TryParse(UserEnt.Indutydate, out DTime))
                    {
                        TM.Indutydate = DTime;
                    }

                    if (!string.IsNullOrEmpty(Dt.Rows[i]["是否已用"] + ""))
                    {
                        string val = string.Empty;
                        val         = ((Dt.Rows[i]["是否已用"] + "") == "是" || (Dt.Rows[i]["是否已用"] + "") == "Y") ? "Y" : "N";
                        TM.HaveUsed = val;
                    }

                    if (Group != null)
                    {
                        TM.Corp     = Group.GroupID;
                        TM.CorpName = Group.Name;
                    }
                    if (DeptGroup != null)
                    {
                        TM.DeptId   = DeptGroup.GroupID;
                        TM.DeptName = DeptGroup.Name;
                    }

                    TM.CreateTime = DateTime.Now;
                    TM.UserId     = UserEnt.UserID;
                    TM.Create();
                }
                catch { }
            }
            this.PageState.Add("State", "1");
        }
예제 #13
0
        private void DoSelect()
        {
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = UsrWomanWelfare.Find(id);
                }
                this.SetFormData(ent);
            }

            if (op == "c" || op == "create")
            {
                string userid = "";
                if (UserInfo != null)
                {
                    userid = UserInfo.UserID;
                }
                else
                {
                    userid = RequestData.Get <string>("userid");
                }



                //  string sql = "select * from UsrTravelWelfare";

                UsrWomanWelfare[] TWEnt = UsrWomanWelfare.FindAllByProperties(UsrWomanWelfare.Prop_UserId, RequestData.Get <string>("userid"), UsrWomanWelfare.Prop_NoticeId, RequestData.Get <string>("noticeid"));
                if (TWEnt.Length != 0)
                {
                    this.SetFormData(TWEnt[0]);
                }
                else
                {
                    var Ent = SysUser.FindFirstByProperties("UserID", userid);

                    //用来获取配置的审批人
                    string SQL = "select top 1 * from  FL_Culture..SysApproveConfig where CompanyId='{0}' and len(WomanWelfareId)>0 ";
                    SQL = string.Format(SQL, Ent.Pk_corp);
                    DataTable Dt = DataHelper.QueryDataTable(SQL);

                    //公司与部门
                    SQL = @"select B.GroupID As CompanyId,B.Name As CompanyName,C.GroupID AS DeptId,C.Name As DeptName
                        from  sysuser As A
	                        left join sysgroup As B
	                        on A.pk_corp=B.groupID
                        left join sysgroup As C
	                        on C.GroupID=A.pk_deptdoc
                        where A.UserID='{0}'";
                    SQL = string.Format(SQL, userid);
                    DataTable Dt1 = DataHelper.QueryDataTable(SQL);

                    string CompanyName = string.Empty, CompanyId = string.Empty;
                    string DeptName = string.Empty, DeptId = string.Empty;

                    if (Dt1.Rows.Count > 0)
                    {
                        CompanyName = Dt1.Rows[0]["CompanyName"].ToString();
                        CompanyId   = Dt1.Rows[0]["CompanyId"].ToString();
                        DeptId      = Dt1.Rows[0]["DeptId"].ToString();
                        DeptName    = Dt1.Rows[0]["DeptName"].ToString();
                    }

                    if (Ent != null)
                    {
                        var Obj = new
                        {
                            UserId     = Ent.UserID,
                            UserName   = Ent.Name,
                            Sex        = Ent.Sex,
                            Age        = Ent.Wage,
                            WorkNo     = Ent.WorkNo,
                            IndutyData = Ent.Indutydate,

                            CompanyName = CompanyName,
                            CompanyId   = CompanyId,
                            DeptId      = DeptId,
                            DeptName    = DeptName,

                            ApproveName   = Dt == null ? "" : Dt.Rows.Count > 0 ? Dt.Rows[0]["WomanWelfareName"].ToString() : "",
                            ApproveUserId = Dt == null ? "" : Dt.Rows.Count > 0 ? Dt.Rows[0]["WomanWelfareId"].ToString() : ""
                        };
                        this.SetFormData(Obj);
                    }
                }
            }
        }
예제 #14
0
        private void DoSelect()
        {
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = UsrHealthyWelfare.Find(id);
                }
                this.SetFormData(ent);
            }
            if (op == "c" || op == "create")
            {
                var Ent = SysUser.FindFirstByProperties("UserID", UserInfo.UserID);

                //用来获取配置的审批人
                string SQL = "select top 1 * from  FL_Culture..SysApproveConfig where CompanyId='{0}' and len(HealthyWelfareId)>0 ";
                SQL = string.Format(SQL, Ent.Pk_corp);
                DataTable Dt = DataHelper.QueryDataTable(SQL);

                //公司与部门
                SQL = @"select B.GroupID As CompanyId,B.Name As CompanyName,C.GroupID AS DeptId,C.Name As DeptName
                        from  sysuser As A
	                        left join sysgroup As B
	                        on A.pk_corp=B.groupID
                        left join sysgroup As C
	                        on C.GroupID=A.pk_deptdoc
                        where A.UserID='{0}'";
                SQL = string.Format(SQL, UserInfo.UserID);
                DataTable Dt1 = DataHelper.QueryDataTable(SQL);

                string CompanyName = string.Empty, CompanyId = string.Empty;
                string DeptName = string.Empty, DeptId = string.Empty;

                if (Dt1.Rows.Count > 0)
                {
                    CompanyName = Dt1.Rows[0]["CompanyName"].ToString();
                    CompanyId   = Dt1.Rows[0]["CompanyId"].ToString();
                    DeptId      = Dt1.Rows[0]["DeptId"].ToString();
                    DeptName    = Dt1.Rows[0]["DeptName"].ToString();
                }

                if (Ent != null)
                {
                    var Obj = new
                    {
                        UserId     = Ent.UserID,
                        UserName   = Ent.Name,
                        Sex        = Ent.Sex,
                        Age        = Ent.Wage,
                        WorkNo     = Ent.WorkNo,
                        IndutyData = Ent.Indutydate,

                        CompanyName = CompanyName,
                        CompanyId   = CompanyId,
                        DeptId      = DeptId,
                        DeptName    = DeptName,

                        ApproveName   = Dt == null ? "" : Dt.Rows.Count > 0 ? Dt.Rows[0]["HealthyWelfareName"].ToString() : "",
                        ApproveUserId = Dt == null ? "" : Dt.Rows.Count > 0 ? Dt.Rows[0]["HealthyWelfareId"].ToString() : ""
                    };
                    this.SetFormData(Obj);
                }
            }
        }