Esempio n. 1
0
        /// <summary>
        /// 添加巡检实施
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddInspectionImplement(HttpContext context)
        {
            var jr = new JsonResultModel <int>()
            {
                IsSucceed   = false,
                Data        = 0,
                Msg         = "添加失败",
                RedirectUrl = string.Empty
            };

            //获取传递参数
            string     orderid = context.Request.Params["orderid"];
            string     ordersn = context.Request.Params["ordersn"];
            string     content = context.Request.Params["content"];
            HttpCookie cook    = HttpContext.Current.Request.Cookies["EccmUserinfo"];

            if (cook != null)
            {
                //解密Cookie
                HttpCookie decodeCookie = HttpSecureCookie.Decode(cook);
                string     uid          = decodeCookie.Values["userid"];
                string     imgurl       = context.Request.Params["imgurl"];
                string     type         = context.Request.Params["type"];//1巡检2维保3维修

                //给对象赋值
                EccmInspectionOrderImplementModel model = new EccmInspectionOrderImplementModel();
                model.order_id          = int.Parse(orderid);
                model.equCode           = "";//该处没有设备编码
                model.implement_content = content;
                model.implement_time    = DateTime.Now;
                model.uid_handle        = int.Parse(uid);

                EccmInspectionOrderImplementBLL bll = new EccmInspectionOrderImplementBLL();
                int id = bll.Add(model); //插入并获取id
                if (id > 0)              //实施内容插入成功
                {
                    EccmImplementImgModel img_model = new EccmImplementImgModel();
                    img_model.implement_id = id;
                    img_model.img_path     = imgurl;
                    img_model.img_type     = int.Parse(type);; //1巡检2维保3维修
                    EccmImplementImgBLL img_bll = new EccmImplementImgBLL();
                    if (img_bll.Add(img_model))                //插入实施图片
                    {
                        EccmInspectionOrderModel inspection_model = new EccmInspectionOrderModel();
                        inspection_model.order_id          = int.Parse(orderid);
                        inspection_model.order_stats       = 4;//0未派单1已派单2已接单3处理中4完成
                        inspection_model.order_finish_time = DateTime.Now;
                        EccmInspectionOrderBLL inspection_bll = new EccmInspectionOrderBLL();
                        inspection_bll.UpdateStates(inspection_model);//更改订单为完成
                        jr.IsSucceed = true;
                        jr.Msg       = "添加成功";
                    }
                }
            }
            return(JsonConvert.SerializeObject(jr));
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(EccmImplementImgModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" insert into eccm_implement_img(implement_id, img_path, img_type) values ");
            foreach (string s in model.img_path.Split(','))
            {
                strSql.Append("(" + model.implement_id + ",'" + s + "'," + model.img_type + "),");
            }
            int rows = MySQLHelper.ExecuteNonQuery(strSql.ToString().Substring(0, strSql.Length - 1));

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(EccmImplementImgModel model)
 {
     return(dal.Add(model));
 }