예제 #1
0
파일: yinhuan.cs 프로젝트: zyuhua88/GDT-Api
        /// <summary>
        /// 修改隐患信息
        /// </summary>
        /// <param name="data"></param>
        /// <param name="yh_no"></param>
        /// <returns></returns>
        public HttpResponseMessage UpdateYinHuan(dynamic data, string yh_no)
        {
            Deparment de = new Deparment();

            Entity.yinhuan_down y = down.Value.SetData(data);
            string sql            = "update yinhuan set yh_applicationName=@yh_applicationName,yh_body=@yh_body,yh_create_time=" + y.yh_create_time + "," +
                                    "yh_area=@yh_area,yh_type=@yh_type,yh_dengji=" + y.yh_dengji + ",yh_desc=@yh_desc,yh_img=@yh_img," +
                                    "yh_imgodd=@yh_imgodd,yh_timestart=" + y.yh_timestart + ",yh_timeend=" + y.yh_timeend + "," +
                                    "yh_user_from=" + y.yh_user_from + ",yh_deparment=" + y.yh_deparment + ",yh_to_deparment=" + y.yh_to_deparment + "," +
                                    "yh_yaoqiu=@yh_yaoqiu,yh_to_user="******",yh_shishi_time=" + y.yh_shishi_time + "," +
                                    "yh_zhenggaihou=@yh_zhenggaihou,yh_queren_user="******",yh_queren_time=" + y.yh_queren_time + "," +
                                    "yh_send_state=" + y.yh_send_state + " where yh_no=@yh_no";

            SqlParameter[] sp =
            {
                new SqlParameter("@yh_no",              yh_no),
                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编号
                    int t       = Zh.Tool.Date_Tool.TimeToInt(DateTime.Now);
                    sql = "insert into yinhuan_up(yh_no,yh_to_userup,yh_state,yh_time) values " +
                          "('" + y.yh_no + "'," + upadmin + ",0," + t + ")";
                    help.Count(sql);
                }
                obj = new
                {
                    code = 0,
                    msg  = "修改成功"
                };
            }
            else
            {
                obj = new
                {
                    code = 1,
                    msg  = "修改失败"
                };
            }
            return(Zh.Tool.Json.GetJson(obj));
        }
예제 #2
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));
        }