コード例 #1
0
        /// <summary>
        /// 添加或都修改用户的模块权限信息  如果用户权限存在,则修改
        /// </summary>
        /// <param name="data"></param>
        /// <param name="us_id"></param>
        /// <returns></returns>
        public HttpResponseMessage Add(dynamic data, int us_id)
        {
            //查询是否为该用户添加了页面模块信息
            string sql = "select count(id) from user_menu where us_id=" + us_id;

            if (Convert.ToInt32(help.FirstRow(sql)) > 0)
            {
                return(Update(data, us_id));
            }
            else
            {
                string menu = data.menu;
                sql = "insert into user_menu(us_id,menu) values(" + us_id + ",'" + menu + "')";
                if (help.Count(sql) > 0)
                {
                    obj = new
                    {
                        code = 0,
                        msg  = "ok"
                    };
                }
                else
                {
                    obj = new
                    {
                        code = 1,
                        msg  = "error"
                    };
                }
                return(Zh.Tool.Json.GetJson(obj));
            }
        }
コード例 #2
0
ファイル: Test_classify.cs プロジェクト: zyuhua88/GDT-Api
        /// <summary>
        /// 上传试题分类名称
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public HttpResponseMessage Add(dynamic data)
        {
            Entity.test t   = test.Value.SetData(data);
            string      sql = "insert into test_classify(t_name,create_time,us_id,head_id,type_a,type_b,type_c,type_d,is_send,defen_a,defen_b," +
                              "defen_c,defen_d,t_types) values(" +
                              "@t_name," + t.create_time + "," + t.us_id + "," + t.head_id + "," + t.type_a + "," + t.type_b + "," + t.type_c + "," + t.type_d + "," +
                              "0," + t.defen_a + "," + t.defen_b + "," + t.defen_c + "," + t.defen_d + "," + t.t_types + " )";

            SqlParameter[] sp =
            {
                new SqlParameter("@t_name", t.t_name)
            };
            int i = help.Count(sql, sp);

            if (i > 0)
            {
                obj = new
                {
                    code = 0,
                    msg  = "上传成功"
                };
            }
            else
            {
                obj = new
                {
                    code = 1,
                    msg  = "上传失败"
                };
            }
            return(Zh.Tool.Json.GetJson(obj));
        }
コード例 #3
0
ファイル: FileList.cs プロジェクト: zyuhua88/GDT-Api
        /// <summary>
        /// 把文件信息保存到数据库中
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public HttpResponseMessage Add(dynamic data)
        {
            Entity.studenttime st = s.Value.SetData(data);

            string sql = "insert into filelist(title,img,filepath,updatetime,types,loaduser,studenttime,head_id,filetype,jibie) " +
                         "values('" + st.title + "','" + st.img + "','" + st.filepath + "'," + st.updatetime + ",'" + st.types + "'," + st.loaduser + "," +
                         "" + st.studenttime + "," + st.head_id + "," + st.filetype + "," + st.jibie + ")";
            int i = help.Count(sql);

            if (i > 0)
            {
                obj = new
                {
                    code = 0,
                    msg  = "文件上传成功"
                };
            }
            else
            {
                obj = new {
                    code = 1,
                    msg  = "文件发布失败"
                };
            }
            return(Zh.Tool.Json.GetJson(obj));
        }
コード例 #4
0
        /// <summary>
        /// 添加班组信息
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public HttpResponseMessage AddClass(dynamic data)
        {
            Entity.user_detail us  = user.Value.SetData(data);
            string             sql = "insert into classes(c_name,c_work_name,c_work_desc,b_id) " +
                                     "values('" + us.c_name + "','" + us.c_work_name + "','" + us.c_work_desc + "'," + us.b_id + ")";
            int i = help.Count(sql);

            if (i > 0)
            {
                obj = new
                {
                    code = 0,
                    msg  = "添加班组成功"
                };
            }
            else
            {
                obj = new
                {
                    code = 1,
                    msg  = "添加班组失败"
                };
            }
            return(Zh.Tool.Json.GetJson(obj));
        }
コード例 #5
0
ファイル: company.cs プロジェクト: zyuhua88/GDT-Api
        /// <summary>
        /// 修改所在子公司的公司信息
        /// </summary>
        /// <param name="data"></param>
        /// <param name="com_id"></param>
        /// <returns></returns>
        public HttpResponseMessage Update_company(dynamic data, int com_id)
        {
            Entity.user_detail d   = user.Value.SetData(data);
            string             sql = "update company set com_name=@com_name,com_size=@com_size,work_address=@work_address " +
                                     "where com_id=" + com_id + "";

            SqlParameter[] sp =
            {
                new SqlParameter("@com_name",     d.com_name),
                new SqlParameter("@com_size",     d.com_size),
                new SqlParameter("@work_address", d.work_address)
            };
            int i = help.Count(sql, sp);

            if (i > 0)
            {
                obj = new
                {
                    code = "A0000",
                    msg  = "修改成功"
                };
            }
            else
            {
                obj = new {
                    code = "A0001",
                    msg  = "修改失败"
                };
            }
            return(help.ToJson(obj));
        }
コード例 #6
0
        /// <summary>
        /// 添加培训计划
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public int Add(dynamic data)
        {
            Entity.projectlist t   = p.Value.SetData(data);
            string             sql = "insert into train_project values('" + t.t_name + "'," + t.start_time + "," + t.end_time + ",'" + t.score_name + "'," +
                                     "'" + t.b_id + "'," + t.c_id + "," + t.head_id + "," + t.com_id + "," + t.time_length + ",'" + t.score_type + "','" + t.descs + "'," + t.create_time + "," +
                                     "" + t.us_id + "," + t.work_usid + ")";

            return(help.Count(sql));
        }
コード例 #7
0
        /// <summary>
        /// 添加集团信息 成功返回受影响的行数
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public int AddHeadOffice(dynamic data)
        {
            Entity.user_detail d   = user.Value.SetData(data);
            string             sql = "insert into head_office(head_name,head_size,head_address,head_logo) values(" +
                                     "@head_name,@head_size,@head_address,@head_logo)";

            SqlParameter[] sp =
            {
                new SqlParameter("@head_name", d.head_name)
                ,                              new SqlParameter("@head_size", d.head_size)
                ,                              new SqlParameter("@head_address", d.head_address)
                ,                              new SqlParameter("@head_logo", d.head_logo)
            };
            return(help.Count(sql, sp));
        }
コード例 #8
0
        public void Login_Log(object us_id)
        {
            int usid = 0;

            if (us_id == null)
            {
                return;
            }
            else
            {
                usid = Convert.ToInt32(us_id);
            }
            var    login_time = Zh.Tool.Date_Tool.TimeToInt(DateTime.Now);
            string sql        = "insert into login_log(us_id,login_time) values(" + usid + "," + login_time + ")";

            help.Count(sql);
        }
コード例 #9
0
ファイル: Card_Sign.cs プロジェクト: zyuhua88/GDT-Api
        /// <summary>
        /// 为学员添加三级教育学习卡
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public int Add(dynamic data)
        {
            Entity.card_sign si  = sign.Value.SetData(data);
            string           sql = "insert into card_sign(end_time,com_sign,com_time,b_sign,b_time,c_sign,c_time,us_id) values(" +
                                   "" + si.end_time + ",'" + si.com_sign + "'," + si.com_time + ",'" + si.b_sign + "'," + si.b_time + ",'" + si.c_sign + "'," + si.c_time + "," +
                                   "" + si.us_id + ")";
            int i = help.Count(sql);

            return(i);
        }
コード例 #10
0
ファイル: yhTable.cs プロジェクト: zyuhua88/GDT-Api
        /// <summary>
        /// 创建检查表
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public int CreateYh(dynamic data)
        {
            Entity.yhtable y = yh.Value.SetData(data);
            ////获取编号
            string no  = SetNo(y.y_headid);
            string sql = "insert into yhtable values('" + y.y_name + "'," + y.y_createtime + ",'" + y.y_body + "','" + y.y_area + "'," +
                         "'" + y.y_type + "'," + y.y_dengji + ",'" + y.y_desc + "','" + y.y_img1 + "'," + y.y_endtime + "," + y.y_usid + "," + y.y_zguser + ",'" + y.y_yaoqiu + "', " +
                         "" + y.y_headuser + "," + y.y_headtype + ",'" + y.y_zgdesc + "',0,'" + y.y_qrdesc + "'," +
                         "'" + y.y_qrimg + "'," + y.y_status + "," + y.y_qruser + ",0," + y.y_headid + ",'" + no + "','')";

            string sql2 = "";

            if (y.y_headuser > 0)
            {//如果需要上级审批发信息给上级领导进行通知
                sql2 = "select mobile from user_detail where us_id=" + y.y_headuser;
                object objs = help.FirstRow(sql2);
                if (objs != null)
                {
                    if (objs.ToString() != "")
                    {
                        sendXinXi(objs.ToString(), "一个安全检查单需要您的审批,检查类型:" + y.y_type + "。详情请登录系统查看!");
                    }
                }
            }
            else  //需要上级审批 直接发信息给整改人
            {
                sql2 = "select mobile from user_detail where us_id=" + y.y_zguser;
                object objs = help.FirstRow(sql2);
                if (objs != null)
                {
                    if (objs.ToString() != "")
                    {
                        sendXinXi(objs.ToString(), "您收到一个检查整改通知单,检查类型:" + y.y_type + "。详情请登录系统查看并及时整改!");
                    }
                }
            }
            return(help.Count(sql));
        }
コード例 #11
0
ファイル: yinhuan.cs プロジェクト: zyuhua88/GDT-Api
        /// <summary>
        /// 添加隐患信息表
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public HttpResponseMessage AddYinHuan(dynamic data)
        {
            Deparment de = new Deparment();

            Entity.yinhuan y = down.Value.SetData(data);

            string sql = "insert into yinhuan(yh_no,yh_applicationName,yh_body,yh_create_time,yh_area,yh_type,yh_dengji,yh_desc,yh_img," +
                         "yh_imgodd,yh_timestart,yh_timeend,yh_user_from,yh_deparment,yh_to_deparment,yh_yaoqiu,yh_to_user,yh_shishi_time," +
                         "yh_zhenggaihou,yh_queren_user,yh_queren_time,yh_send_state) values('" + data.yh_no + "',@yh_applicationName,@yh_body," + y.yh_create_time + "," +
                         "@yh_area,@yh_type," + y.yh_dengji + ",@yh_desc,@yh_img," +
                         "@yh_imgodd," + y.yh_timestart + "," + y.yh_timeend + "," + y.yh_user_from + "," + y.yh_deparment + "," + y.yh_to_deparment + "," +
                         "@yh_yaoqiu," + y.yh_to_user + "," +
                         "" + y.yh_shishi_time + "," +
                         "@yh_zhenggaihou," + y.yh_queren_user + "," + y.yh_queren_time + "," + y.yh_send_state + ")";

            SqlParameter[] sp =
            {
                new SqlParameter("@yh_applicationName", y.yh_applicationName),
                new SqlParameter("@yh_body",            y.yh_body),
                new SqlParameter("@yh_area",            y.yh_area),
                new SqlParameter("@yh_type",            y.yh_type),
                new SqlParameter("@yh_desc",            y.yh_desc),
                new SqlParameter("@yh_img",             y.yh_img),
                new SqlParameter("@yh_imgodd",          y.yh_imgodd),
                new SqlParameter("@yh_yaoqiu",          y.yh_yaoqiu),
                new SqlParameter("@yh_zhenggaihou",     y.yh_zhenggaihou)
            };
            int i = help.Count(sql, sp);

            if (i > 0)
            {
                if (y.yh_send_state == 1)
                {
                    int upadmin = de.QueryAdminId(y.yh_deparment); //得到我要上报的领导ID编号
                    AddYinHuan_up(data, upadmin);                  //添加要上报通知的领导
                }

                obj = new
                {
                    code = 0,
                    msg  = "保存成功"
                };
            }
            else
            {
                obj = new
                {
                    code = 1,
                    msg  = "保存失败"
                };
            }
            return(Zh.Tool.Json.GetJson(obj));
        }
コード例 #12
0
        //客户文件上传 读取excel文件并写入到数据库中
        public string Upload_file(HttpPostedFile file, int classify_id)
        {
            string obj = "{\"code\": 0,\"msg\": \"\",\"data\": {\"src\": \"http://cdn.layui.com/123.jpg\"}} ";
            string msg = "";

            try
            {
                string type  = file.FileName.Substring(file.FileName.LastIndexOf("."), file.FileName.Length - file.FileName.LastIndexOf("."));
                string nname = "";
                if (type == ".xls" || type == ".xlsx")
                {
                    nname = DateTime.Now.ToFileTime() + type;
                }
                else
                {
                    return(obj = "{\"code\": 1,\"msg\": \"文件格式不正确\",\"data\": {\"src\": \"\"}} ");
                }

                if (Zh.Tool.File_Tool.File_Upload(file.InputStream, AppDomain.CurrentDomain.BaseDirectory + "/Files/" + nname, out msg))
                {
                    DataTable dt  = Zh.Tool.Excel_Tool.ReadExcel(AppDomain.CurrentDomain.BaseDirectory + "/Files/" + nname);
                    string    sql = "insert into test(classify_id,t_type,t_desc,t_title,t_a,t_b,t_c,t_d,t_e," +
                                    "t_f,daan)";
                    if (dt.Columns.Count < 10)
                    {
                        msg = "表格模版不正确";
                        return(obj = "{\"code\": 1,\"msg\": \"表格模版不正确\",\"data\": {\"src\": \"\"}} ");
                    }

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (i == 0)
                        {
                            sql += " values(" + classify_id + ",'" + dt.Rows[i][0] + "','" + dt.Rows[i][1] + "','" + dt.Rows[i][2] + "'," +
                                   "'" + dt.Rows[i][3] + "','" + dt.Rows[i][4] + "','" + dt.Rows[i][5] + "','" + dt.Rows[i][6] + "'," +
                                   "'" + dt.Rows[i][7] + "','" + dt.Rows[i][8] + "','" + dt.Rows[i][9] + "') ";
                        }
                        else
                        {
                            sql += " ,(" + classify_id + ",'" + dt.Rows[i][0] + "','" + dt.Rows[i][1] + "','" + dt.Rows[i][2] + "'," +
                                   "'" + dt.Rows[i][3] + "','" + dt.Rows[i][4] + "','" + dt.Rows[i][5] + "','" + dt.Rows[i][6] + "'," +
                                   "'" + dt.Rows[i][7] + "','" + dt.Rows[i][8] + "','" + dt.Rows[i][9] + "') ";
                        }
                    }
                    int ii = help.Count(sql);
                    if (ii > 0)
                    {
                        return(obj = "{\"code\": 0,\"msg\": \"数据导入成功,成功上传" + dt.Rows.Count + "条试题信息!\",\"data\": {\"src\": \"\"}} ");
                    }
                    else
                    {
                        return(obj = "{\"code\": 1,\"msg\": \"数据导入失败\",\"data\": {\"src\": \"\"}} ");
                    }
                }
                else
                {
                    return(obj = "{\"code\": 1,\"msg\": \"在上传文件时出错\",\"data\": {\"src\": \"\"}} ");
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(obj = "{\"code\": 1,\"msg\": \"" + msg + "\",\"data\": {\"src\": \"\"}} ");
            }
        }