Exemplo n.º 1
0
        private string GetBefore(string action, string type, string id)
        {
            string str = string.Empty;

            if (action.Equals("TB_USER"))
            {
                if (type.Equals("新增用户") || type.Equals("删除用户"))
                {
                    str = string.Empty;
                }
                else if (type.Equals("IP管理"))
                {
                    DataSet ds = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys("select * from TB_USER_IP where user_id='" + id + "'");
                    if (ds != null)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            str += "计算机名:" + ds.Tables[0].Rows[i]["computer_name"].ToString() + ",外网地址:" + ds.Tables[0].Rows[i]["outside_net"] + ",内网地址:" + ds.Tables[0].Rows[i]["inside_net"].ToString() + ";";
                        }
                    }
                }
                else
                {
                    DataSet ds = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys("select * from TB_USER where userid='" + id + "'");
                    if (ds != null)
                    {
                        DataSet ds_role     = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys("select (select rname from tb_role where roleid=t.roleid) as rname from TB_USER_ROLE t where t.userid=" + id + "");
                        string  before_role = string.Empty;
                        if (ds_role != null)
                        {
                            for (int i = 0; i < ds_role.Tables[0].Rows.Count; i++)
                            {
                                before_role += ds_role.Tables[0].Rows[i]["rname"].ToString() + ",";
                            }
                        }
                        str = "登录账号:" + ds.Tables[0].Rows[0]["loginname"].ToString() + "|LOGINNAME;真实姓名:" + ds.Tables[0].Rows[0]["REALNAME"].ToString() + "|REALNAME;性别:" + ds.Tables[0].Rows[0]["SEX"].ToString() + "|SEX;手机:" + ds.Tables[0].Rows[0]["TEL"].ToString() + "|TEL;所属单位:" + ds.Tables[0].Rows[0]["UNIT"].ToString() + "|UNIT;邮箱:" + ds.Tables[0].Rows[0]["EMAIL"].ToString() + "|EMAIL;密码:" + DESEncrypt.Decrypt(ds.Tables[0].Rows[0]["PWD"].ToString()) + "|PWD;拥有角色:" + before_role + "|rids";
                    }
                }
            }
            else
            {
                if (type.Equals("新增角色") || type.Equals("删除角色"))
                {
                    str = string.Empty;
                }
                else
                {
                    if (type.Equals("编辑角色"))
                    {
                        DataSet ds = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys("select * from TB_ROLE where ROLEID='" + id + "'");
                        if (ds != null)
                        {
                            str = "角色名称:" + ds.Tables[0].Rows[0]["RNAME"].ToString() + "|RNAME;身份:" + ds.Tables[0].Rows[0]["IDENTITY"].ToString() + "|IDENTITY;角色说明:" + ds.Tables[0].Rows[0]["MEMO"].ToString() + "|MEMO";
                        }
                    }
                }
            }
            return(str);
        }
Exemplo n.º 2
0
 private string getUserByRoleId(string id)
 {
     try
     {
         string  str = "";
         string  sql = "select t.loginname,t.realname from tb_user t,tb_user_role s where s.roleid=" + id + " and t.userid=s.userid";
         DataSet ds  = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys(sql);
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             str += ds.Tables[0].Rows[i]["realname"].ToString() + "\n";
         }
         return(str);
     }
     catch
     {
         return("");
     }
 }
Exemplo n.º 3
0
        public string getmenu(string rid, string mflags)
        {
            MessageModel <DataTable> result = new MessageModel <DataTable>();
            DataSet ds = null;

            try
            {
                string str = string.Empty;
                if (mflags.EndsWith(","))
                {
                    mflags = mflags.Substring(0, mflags.Length - 1);
                }
                string[] temp = mflags.Split(',');
                string where = string.Empty;
                for (int i = 0; i < temp.Length; i++)
                {
                    where += "'" + temp[i] + "',";
                }
                if (string.IsNullOrEmpty(where))
                {
                    return(null);
                }
                else
                {
                    where = where.Substring(0, where.Length - 1);
                    string sql = "select * from tb_menu t where t.mflag in(" + where + ") order by t.mparent";
                    ds = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys(sql);
                    // return ds;
                }
            }
            catch
            {
                //return null;
            }
            result.data    = ds.Tables[0];
            result.code    = System.Net.HttpStatusCode.OK;
            result.success = false;
            result.msg     = "获取成功";
            return(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
Exemplo n.º 4
0
        public string getbmunu(string r_id)
        {
            MessageModel <DataTable> result = new MessageModel <DataTable>();
            string  str = string.Empty;
            string  sql = "select m.* from TB_ROLE_MENU t,tb_menu m where t.mflag=m.mflag and t.roleid=" + r_id + " order by m.mparent";
            DataSet ds  = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys(sql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                result.data = ds.Tables[0];
                result.code = System.Net.HttpStatusCode.OK;
            }
            else
            {
                result.data = null;
                result.code = System.Net.HttpStatusCode.Accepted;
            }

            result.success = false;
            result.msg     = "获取成功";
            return(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
Exemplo n.º 5
0
        public string GetAdminApprovalTables(string id, string o_type, string r_id)
        {
            TableModel <ArrayList> result = new TableModel <ArrayList>();
            int total = 1;
            //List<string[]> list = new List<string[]>();
            ArrayList list = new ArrayList();

            try
            {
                string sql_temp = string.Empty;
                if (o_type.Equals("TB_USER"))
                {
                    sql_temp += ",(select loginname from tb_user where userid=t.oid) as name";
                }
                else
                {
                    sql_temp += ",(select rname from tb_role where roleid=t.oid) as name";
                }
                DataSet ds = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys("select t.*" + sql_temp + " from TB_ROLE_LOG t  where t.id='" + id + "' and t.type='" + o_type + "' ");

                if (ds != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        string type    = string.Empty;
                        string content = string.Empty;
                        string status  = string.Empty;

                        string temp_content = ds.Tables[0].Rows[i]["CONTENT"].ToString();
                        if (!string.IsNullOrEmpty(temp_content))
                        {
                            string[] strs1 = temp_content.Split('|');
                            type = strs1[0];
                            if (!string.IsNullOrEmpty(strs1[1]))
                            {
                                string[] strs2 = strs1[1].Split(';');
                                content = "<ul class=\"ultree\">";
                                for (int j = 0; j < strs2.Length; j++)
                                {
                                    content += "<li>" + strs2[j] + "</li>";
                                }
                                content += "</ul>";
                            }
                        }
                        switch (ds.Tables[0].Rows[i]["status"].ToString())
                        {
                        case "-1": status = "<span style=\"color:red;\">审批不通过</span>"; break;

                        case "0": status = "<span style=\"color:blue;\">待审批</span>"; break;

                        case "1": status = "<span style=\"color:green;\">审批已通过</span>"; break;
                        }
                        string before_content = string.Empty;

                        before_content = GetBefore(o_type, type, ds.Tables[0].Rows[i]["oid"].ToString());
                        //string before_content = string.Empty;
                        string after_content = string.Empty;
                        if (!string.IsNullOrEmpty(before_content))
                        {
                            if (type.Equals("IP管理"))
                            {
                                string[] arr_remark = ds.Tables[0].Rows[i]["sqlremark"].ToString().Split(';');
                                string[] strs2      = before_content.Split(';');
                                before_content = "<ul class=\"ultree\">";
                                after_content  = before_content;
                                for (int j = 0; j < strs2.Length; j++)
                                {
                                    before_content += "<li>" + strs2[j] + "</li>";
                                }
                                for (int j = 0; j < arr_remark.Length; j++)
                                {
                                    after_content += "<li>" + arr_remark[j] + "</li>";
                                }

                                before_content += "</ul>";
                                after_content  += "</ul>";
                            }
                            else
                            {
                                string[] arr_remark = ds.Tables[0].Rows[i]["sqlremark"].ToString().Split(';');

                                string[] strs2 = before_content.Split(';');
                                before_content = "<ul class=\"ultree\">";
                                after_content  = before_content;
                                for (int j = 0; j < strs2.Length; j++)
                                {
                                    string after_value = strs2[j].Split('|')[0];
                                    string str_tmp     = strs2[j].Split('|')[1];
                                    for (int k = 0; k < arr_remark.Length; k++)
                                    {
                                        if (str_tmp == arr_remark[k].Split(':')[0])
                                        {
                                            after_value = after_value.Split(':')[0] + ":" + arr_remark[k].Split(':')[1];
                                        }
                                    }
                                    after_content  += "<li><span id=\"span_" + str_tmp + "\">" + after_value + "<span></li>";
                                    before_content += "<li>" + strs2[j].Split('|')[0] + "</li>";
                                }
                                before_content += "</ul>";
                                after_content  += "</ul>";
                            }
                        }
                        if (type == "分配菜单")
                        {
                            string sqlremark = ds.Tables[0].Rows[i]["sqlremark"].ToString();
                            before_content = getbmunu(r_id);
                            after_content  = getmenu(r_id, sqlremark);
                            //after_content = System.Text.Encoding.Default.GetString((byte[])ds.Tables[0].Rows[i]["sqlremark"]);
                        }
                        list.Add(new
                        {
                            czlx = type,
                            xgq  = before_content,
                            xgh  = after_content,
                            xglr = content,
                            zt   = ds.Tables[0].Rows[i]["remark"].ToString()
                        });
                        //list.Add(new string[]
                        //{
                        //    //czlx = type,
                        //    //xgq = before_content,
                        //    //xgh = after_content,
                        //    //xglr = content,
                        //    //zt = ds.Tables[0].Rows[i]["remark"].ToString()
                        //   (i + 1).ToString(),
                        //    type,
                        //    content,
                        //    status,
                        //    ds.Tables[0].Rows[i]["remark"].ToString(),
                        //    ds.Tables[0].Rows[i]["name"].ToString(),
                        //    before_content,
                        //    after_content,
                        //    System.Text.Encoding.Default.GetString((byte[])ds.Tables[0].Rows[i]["sqlremark"])
                        //});
                    }
                }
            }
            catch
            {
            }
            result.Data  = list;
            result.Count = total;
            result.Code  = System.Net.HttpStatusCode.OK;
            return(Newtonsoft.Json.JsonConvert.SerializeObject(result));
            // return "";
        }
Exemplo n.º 6
0
        public string noadopt(int id)
        {
            MessageModel <string> result = new MessageModel <string>();
            string        data           = string.Empty;
            List <string> DelList        = new List <string>();//删除事务
            DataSet       ds             = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys("select * from tb_role_log where id='" + id + "'");

            if (ds != null)
            {
                string content = ds.Tables[0].Rows[0]["CONTENT"].ToString();
                if (content.StartsWith("新增"))
                {
                    string logsql = string.Empty;
                    if (content.StartsWith("新增用户"))
                    {
                        logsql  = "delete from TB_USER where USERID='" + ds.Tables[0].Rows[0]["oid"].ToString() + "';";
                        logsql += "delete from tb_role_log_process where  lid in(select id from tb_role_log where type='TB_USER' and oid='" + ds.Tables[0].Rows[0]["oid"].ToString() + "');";
                        logsql += "delete from tb_role_log where type='TB_USER' and oid='" + ds.Tables[0].Rows[0]["oid"].ToString() + "';";
                    }
                    else if (content.StartsWith("新增角色"))
                    {
                        logsql  = "delete from TB_ROLE where roleid='" + ds.Tables[0].Rows[0]["oid"].ToString() + "';";
                        logsql += "delete from tb_role_log_process where  lid in(select id from tb_role_log where type='TB_ROLE' and oid='" + ds.Tables[0].Rows[0]["oid"].ToString() + "');";
                        logsql += "delete from tb_role_log where type='TB_ROLE' and oid='" + ds.Tables[0].Rows[0]["oid"].ToString() + "';";
                    }
                    logsql = !string.IsNullOrEmpty(logsql) ? logsql.Substring(0, logsql.Length - 1) : string.Empty;
                    string[] arr_del = logsql.Split(';');

                    for (int i = 0; i < arr_del.Length; i++)
                    {
                        //CommandInfo info = new CommandInfo();
                        //info.CommandText = arr_del[i];
                        DelList.Add(arr_del[i]);
                    }
                }
            }

            // string update = "update TB_ROLE_LOG set status='-1' where id='" + id + "'";
            int update = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Update("update TB_ROLE_LOG set status='-1' where id='" + id + "'");

            if (update > 0)
            {
                TB_ROLE_LOG_PROCESS rlog_p = new TB_ROLE_LOG_PROCESS();
                rlog_p.LID    = id;
                rlog_p.OMAN   = usermodel.REALNAME;
                rlog_p.OTIME  = DateTime.Now;
                rlog_p.REMARK = "审批不通过";
                role_logbll.AddTB_ROLE_LOG_PROCESS(rlog_p);
                int ss = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().UpdateTran(DelList);
                data = "审批成功";
            }
            else
            {
                data = "审批失败";
            }
            result.data    = data;
            result.code    = System.Net.HttpStatusCode.OK;
            result.success = false;
            result.msg     = "获取成功";
            return(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
Exemplo n.º 7
0
        public string adopt(int id)
        {
            MessageModel <string> result = new MessageModel <string>();
            string data = string.Empty;

            List <string> AddList  = new List <string>(); //添加事务
            List <string> DelList  = new List <string>(); //删除事务
            List <string> EditList = new List <string>(); //修改事务
            DataSet       ds       = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys("select * from TB_ROLE_LOG where id='" + id + "'");

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string   sqls    = ds.Tables[0].Rows[0]["SAVESQL"].ToString();
                    string[] arr_sql = sqls.Split(';');
                    for (int i = 0; i < arr_sql.Length; i++)
                    {
                        //CommandInfo info = new CommandInfo();
                        //info.CommandText = arr_sql[i];
                        if (arr_sql[i].StartsWith("insert"))
                        {
                            AddList.Add(arr_sql[i]);
                        }
                        else if (arr_sql[i].StartsWith("delete"))
                        {
                            DelList.Add(arr_sql[i]);
                        }
                        else if (arr_sql[i].StartsWith("update"))
                        {
                            EditList.Add(arr_sql[i]);
                        }
                    }
                }
            }
            //CommandInfo update = new CommandInfo();
            //update.CommandText = "update TB_ROLE_LOG set status='1' where id='" + id + "'";
            int update = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Update("update TB_ROLE_LOG set status='1' where id = " + id + "");

            int e = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().UpdateTran(EditList);
            int d = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().UpdateTran(DelList);
            int a = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().UpdateTran(AddList);

            if (d > 0 || a > 0 || e > 0)
            {
                TB_ROLE_LOG_PROCESS rlog_p = new  TB_ROLE_LOG_PROCESS();
                rlog_p.LID    = id;
                rlog_p.OMAN   = usermodel.REALNAME;
                rlog_p.OTIME  = DateTime.Now;
                rlog_p.REMARK = "审批通过";
                role_logbll.AddTB_ROLE_LOG_PROCESS(rlog_p);
                data = "审批成功";
            }
            else
            {
                data = "审批失败";
            }
            result.data    = data;
            result.code    = System.Net.HttpStatusCode.OK;
            result.success = false;
            result.msg     = "获取成功";
            return(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
Exemplo n.º 8
0
        public string noadoptmore(string ids)
        {
            MessageModel <string> result = new MessageModel <string>();
            string data = string.Empty;

            try
            {
                //ids = ids.Substring(0, ids.Length - 1);
                string[] arr = ids.Split(',');
                string   add = "";
                for (int i = 0; i < arr.Length; i++)
                {
                    add += "'" + arr[i] + "',";
                }
                add = add.Substring(0, add.Length - 1);
                List <string> DelList = new List <string>();//删除事务
                DataSet       ds      = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys("select * from tb_role_log where id in(" + add + ")");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        string content = ds.Tables[0].Rows[i]["CONTENT"].ToString();
                        if (content.StartsWith("新增"))
                        {
                            string logsql = string.Empty;
                            if (content.StartsWith("新增用户"))
                            {
                                logsql  = "delete from TB_USER where USERID='" + ds.Tables[0].Rows[i]["oid"].ToString() + "';";
                                logsql += "delete from tb_role_log_process where  lid in(select id from tb_role_log where type='TB_USER' and oid='" + ds.Tables[0].Rows[i]["oid"].ToString() + "');";
                                logsql += "delete from tb_role_log where type='TB_USER' and oid='" + ds.Tables[0].Rows[i]["oid"].ToString() + "';";
                            }
                            else if (content.StartsWith("新增角色"))
                            {
                                logsql  = "delete from TB_ROLE where roleid='" + ds.Tables[0].Rows[i]["oid"].ToString() + "';";
                                logsql += "delete from tb_role_log_process where  lid in(select id from tb_role_log where type='TB_ROLE' and oid='" + ds.Tables[0].Rows[i]["oid"].ToString() + "');";
                                logsql += "delete from tb_role_log where type='TB_ROLE' and oid='" + ds.Tables[0].Rows[i]["oid"].ToString() + "';";
                            }
                            logsql = !string.IsNullOrEmpty(logsql) ? logsql.Substring(0, logsql.Length - 1) : string.Empty;
                            string[] arr_del = logsql.Split(';');

                            for (int m = 0; m < arr_del.Length; m++)
                            {
                                DelList.Add(arr_del[m].ToString());
                            }
                        }
                    }
                }
                int update = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Update("update TB_ROLE_LOG set status='-1' where id in(" + add + ")");
                if (update > 0)
                {
                    for (int i = 0; i < arr.Length; i++)
                    {
                        TB_ROLE_LOG_PROCESS rlog_p = new  TB_ROLE_LOG_PROCESS();
                        rlog_p.LID    = Convert.ToDecimal(arr[i]);
                        rlog_p.OMAN   = usermodel.REALNAME;
                        rlog_p.OTIME  = DateTime.Now;
                        rlog_p.REMARK = "审批不通过";
                        role_logbll.AddTB_ROLE_LOG_PROCESS(rlog_p);
                        //YunTuCore.Bussiness.TB_ROLE_LOGBLL().Update(add);
                        int ss = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().UpdateTran(DelList);
                    }
                    data = "审批成功!";
                }
                else
                {
                    data = "审批失败!";
                }
            }
            catch (Exception ex)
            {
                data = "审批失败!";
            }
            result.data    = data;
            result.code    = System.Net.HttpStatusCode.OK;
            result.success = false;
            result.msg     = "获取成功";
            return(Newtonsoft.Json.JsonConvert.SerializeObject(result));
            // return JsonConvert<TableResultFormat<string>>.ObjectToJson(result);
        }
Exemplo n.º 9
0
        public string adoptmore(string ids)
        {
            MessageModel <string> result = new MessageModel <string>();
            string data = string.Empty;

            try
            {
                string[] arr = ids.Split(',');
                string   add = "";
                for (int i = 0; i < arr.Length; i++)
                {
                    add += "'" + arr[i] + "',";
                }
                add = add.Substring(0, add.Length - 1);
                for (int i = 0; i < arr.Length; i++)
                {
                    List <string> AddList  = new List <string>(); //添加事务
                    List <string> DelList  = new List <string>(); //删除事务
                    List <string> EditList = new List <string>(); //修改事务
                    DataSet       ds       = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Querys("select * from TB_ROLE_LOG where id = " + arr[i] + "");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        string   sqls    = ds.Tables[0].Rows[0]["SAVESQL"].ToString();
                        string[] arr_sql = sqls.Split(';');
                        for (int m = 0; m < arr_sql.Length; m++)
                        {
                            //CommandInfo info = new CommandInfo();
                            //info.CommandText = arr_sql[m];
                            if (arr_sql[m].StartsWith("insert"))
                            {
                                AddList.Add(arr_sql[m]);
                            }
                            else if (arr_sql[m].StartsWith("delete"))
                            {
                                DelList.Add(arr_sql[m]);
                            }
                            else if (arr_sql[m].StartsWith("update"))
                            {
                                EditList.Add(arr_sql[m]);
                            }
                        }

                        //CommandInfo update = new CommandInfo();
                        int update = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().Update("update TB_ROLE_LOG set status='1' where id = " + arr[i] + "");
                        //update.CommandText = "update TB_ROLE_LOG set status='1' where id = " + arr[i] + "";
                        //EditList.Add(update);

                        int e = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().UpdateTran(EditList);
                        int d = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().UpdateTran(DelList);
                        int a = new YunTuCore.Bussiness.TB_ROLE_LOGBLL().UpdateTran(AddList);

                        if (d > 0 && a > 0 && e > 0)
                        {
                            TB_ROLE_LOG_PROCESS rlog_p = new TB_ROLE_LOG_PROCESS();
                            rlog_p.LID    = Convert.ToDecimal(arr[i]);
                            rlog_p.OMAN   = usermodel.REALNAME;
                            rlog_p.OTIME  = DateTime.Now;
                            rlog_p.REMARK = "审批通过";
                            role_logbll.AddTB_ROLE_LOG_PROCESS(rlog_p);
                        }
                    }
                }
                data = "审批成功";
            }
            catch (Exception ex)
            {
                data = "审批失败";
            }
            result.data    = data;
            result.code    = System.Net.HttpStatusCode.OK;
            result.success = false;
            result.msg     = "获取成功";
            return(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }