Esempio n. 1
0
 public object DeleteData(string uid)
 {
     var tran = Utility.Database.BeginDbTransaction();
     try
     {
         if (!string.IsNullOrEmpty(uid))
         {
             #region 李总代码
             //删除用户表
             UserInfo _userinfo = new UserInfo();
             DataRowMap rm = new DataRowMap();
             rm.TableName = "FX_UserInfo";
             rm.Fields.Add(new FieldInfo("EnName", null));
             rm.Fields.Add(new FieldInfo("DPID", null));
             rm.Fields.Add(new FieldInfo("UIConfig", null));
             rm.Fields.Add(new FieldInfo("PortalConfig", null));
             rm.Fields.Add(new FieldInfo("RankID", null));
             rm.Condition.Add("UserID=" + uid);
             Utility.Database.Update(rm, tran);
             //删角色
             RoleUserR _roleuserr = new RoleUserR();
             _roleuserr.Condition.Add("UserID=" + uid);
             Utility.Database.Delete<RoleUserR>(_roleuserr, tran);
             //删用户权限组对应关系
             UserGroupR usergroupr = new UserGroupR();
             usergroupr.Condition.Add("UserID=" + uid);
             Utility.Database.Delete<UserGroupR>(usergroupr, tran);
             //删用户和权限直接对应表
             UserPrivilegeR userprivileger = new UserPrivilegeR();
             userprivileger.Condition.Add("UserID=" + uid);
             Utility.Database.Delete<UserPrivilegeR>(userprivileger, tran);
             //用户关联信息表
             FX_UserInfo_Add userAdd = new FX_UserInfo_Add();
             userprivileger.Condition.Add("UID=" + uid);
             Utility.Database.Delete<FX_UserInfo_Add>(userAdd, tran);
             #endregion
             Utility.Database.Commit(tran);
         }
         return new
         {
         };
     }
     catch (Exception ex)
     {
         Utility.Database.Rollback(tran);
         ComBase.Logger(ex); //写异常日志到本地文件夹
         throw (new Exception("获取数据失败!", ex));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 查找年度请假情况
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="year"></param>
        /// <param name="tran"></param>
        /// <returns></returns>
        public CondtionModel GetLeaveCondtionByYear(string uid, string year, IDbTransaction tran)
        {
            CondtionModel condtion = new CondtionModel();
            StringBuilder strSql = new StringBuilder();
            strSql.AppendFormat(@"
            select b1.leaveReason,b1.leaveType,b1.leaveStartTime,b1.leaveEndTime,b1.totalDays,b1.actualDays,d1.mc as leaveTypeName
            from  B_OA_LeaveList as b1
            LEFT JOIN Para_BizTypeItem as d1 on d1.csz =cast(b1.leaveType as nvarchar)-- b1.leaveType
            LEFT JOIN Para_BizTypeDictionary as c1 on  c1.id = d1.flid
            where c1.lx = 'leaveType' and b1.leaveer = '{0}'
            and b1.caseId in
            (select b.CaseID from FX_WorkFlowCase as a
            LEFT JOIN FX_WorkFlowBusAct as b on a.ID = b.CaseID
            where FlowID ='W000079' and ActID = 'A004'
            GROUP BY b.CaseID)
            and b1.leaveStartTime >='2015-01-01' and b1.leaveStartTime <='2015-12-31'
            ", uid);

            DataSet dataSet = Utility.Database.ExcuteDataSet(strSql.ToString(), tran);
            DataTable dataTable = dataSet.Tables[0];
            condtion.dataTable = dataTable;

            strSql.Clear();
            strSql.AppendFormat(@"
            select SUM(b1.actualDays) as actualDays
            from  B_OA_LeaveList as b1
            LEFT JOIN Para_BizTypeItem as d1 on d1.csz =cast(b1.leaveType as nvarchar)-- b1.leaveType
            LEFT JOIN Para_BizTypeDictionary as c1 on  c1.id = d1.flid
            where c1.lx = 'leaveType' and b1.leaveer = 'U000008'
            and b1.caseId in
            (select b.CaseID from FX_WorkFlowCase as a
            LEFT JOIN FX_WorkFlowBusAct as b on a.ID = b.CaseID
            where FlowID ='W000079' and ActID = 'A004'
            GROUP BY b.CaseID)
            and b1.leaveStartTime >='2015-01-01' and b1.leaveStartTime <='2015-12-31'
            ", uid);
            DataTable dataDay = Utility.Database.ExcuteDataSet(strSql.ToString(), tran).Tables[0];
            ConModel con = new ConModel();
            //名字
            con.applyName = ComClass.GetUserInfo(uid).CnName;
            if (dataDay.Rows.Count > 0)
            {
                //已休假日期
                con.haveLeaveDate = float.Parse(dataDay.Rows[0]["actualDays"].ToString());
            }
            FX_UserInfo_Add user = new FX_UserInfo_Add();
            user.Condition.Add("UID =" + uid);
            user = Utility.Database.QueryObject<FX_UserInfo_Add>(user, tran);
            if (user != null)
            {
                //工作年限
                con.workYear = float.Parse(user.WYear.ToString());
                //应享受休假天数
                con.orghtoLeaveDate = float.Parse(user.VDay.ToString());
            }
            condtion.con = con;
            return condtion;
        }
Esempio n. 3
0
 public static FX_UserInfo_Add GetUserInfoAddByUserId(string userid, IDbTransaction tran)
 {
     FX_UserInfo_Add user = new FX_UserInfo_Add();
     user.Condition.Add("UID=" + userid);
     user = Utility.Database.QueryObject<FX_UserInfo_Add>(user, tran);
     return user;
 }
Esempio n. 4
0
        public object SaveData(string json, string userid)
        {
            var tran = Utility.Database.BeginDbTransaction();
            try
            {
                FX_UserInfo_Add userInforAdd = JsonConvert.DeserializeObject<FX_UserInfo_Add>(json);
                if (string.IsNullOrEmpty(userInforAdd.UserID))
                {
                    #region 李总源码
                    UserInfo insertObj = new UserInfo();

                    string New_UserID = Utility.MaxValue<UserInfo>("U", 6);
                    {
                        UserInfo user = new UserInfo();
                        user.Condition.Add("UserID=" + New_UserID);
                        UserInfo findUser = Utility.Database.QueryObject<UserInfo>(user);
                        if (findUser != null) throw new Exception("出现重复UserID,系统异常请及时联系管理员");
                    }
                    insertObj.DPID = userInforAdd.DPID;
                    insertObj.UserID = New_UserID;
                    insertObj.EnName = userInforAdd.EnName;
                    insertObj.PWD = userInforAdd.PWD;
                    insertObj.CnName = userInforAdd.CnName;
                    if (!string.IsNullOrEmpty(userInforAdd.RankID))
                    {
                        insertObj.RankID = userInforAdd.RankID;
                    }
                    else
                    {
                        insertObj.RankID ="0";
                    }
                    Utility.Database.Insert<UserInfo>(insertObj, tran);
                    #endregion

                    //用户表附加信息表
                    userInforAdd.UID = New_UserID;
                    Utility.Database.Insert<FX_UserInfo_Add>(userInforAdd, tran);
                }
                else
                {
                    #region 李总源码
                    if (userInforAdd.UserID == IWorkPrivilegeManage.AdminID) return Utility.JsonMsg(false, "顶级管理员不能编辑");

                    UserInfo _userinfo = new UserInfo();
                    _userinfo.Condition.Add("UserID=" + userInforAdd.UserID);
                    UserInfo _user = Utility.Database.QueryObject(_userinfo);

                    DataRowMap rm = new DataRowMap();
                    rm.TableName = "FX_UserInfo";
                    rm.Condition.Add("UserID=" + userInforAdd.UserID);
                    rm.Fields.Add(new FieldInfo("PWD", userInforAdd.PWD));
                    rm.Fields.Add(new FieldInfo("EnName", userInforAdd.EnName));
                    rm.Fields.Add(new FieldInfo("CnName", userInforAdd.CnName));
                    rm.Fields.Add(new FieldInfo("DPID", userInforAdd.DPID));
                    rm.Fields.Add(new FieldInfo("Phone", userInforAdd.Phone));

                    if (!string.IsNullOrEmpty(userInforAdd.RankID))
                    {
                        rm.Fields.Add(new FieldInfo("RankID", userInforAdd.RankID));
                    }
                    else
                    {
                        rm.Fields.Add(new FieldInfo("RankID","0"));
                    }

                    //if (_user.DPID != userInforAdd.DPID) rm.Fields.Add(new FieldInfo("RankID", null));
                    Utility.Database.Update(rm, tran);
                    #endregion

                    FX_UserInfo_Add userInfor = new FX_UserInfo_Add();
                    userInfor.Condition.Add("UID = " + userInforAdd.UserID);
                    userInfor = Utility.Database.QueryObject<FX_UserInfo_Add>(userInfor, tran);
                    if (userInfor == null)
                    {
                        userInforAdd.UID = userInforAdd.UserID;
                        Utility.Database.Insert(userInforAdd, tran);
                    }
                    else
                    {
                        userInforAdd.Condition.Add("UID=" + userInforAdd.UID);
                        Utility.Database.Update(userInforAdd, tran);
                    }
                }
                Utility.Database.Commit(tran);
                bool b = true;
                return new
                {
                    b = b
                };
            }
            catch (Exception ex)
            {
                Utility.Database.Rollback(tran);
                ComBase.Logger(ex); //写异常日志到本地文件夹
                throw (new Exception("获取数据失败!", ex));
            }
        }
Esempio n. 5
0
 public object GetModel(string flid)
 {
     FX_UserInfo_Add userInforAdd = new FX_UserInfo_Add();
     userInforAdd.DPID = flid;
     return new
     {
         userInforAdd = userInforAdd
     };
 }