Пример #1
0
 /// <summary>
 /// 获取列表(根据查询条件获取全部列表)
 /// </summary>
 /// <param name="view_repairType">传入的实体,可以是一个空实体</param>
 /// <param name="Where">SQL拼接的查询条件字条串,例如: " ID < 100 " </param>
 /// <returns>返回实体列表</returns>
 public static List<View_RepairType> GetList(View_RepairType view_repairType, string Where)
 {
     List<View_RepairType> returnList = new List<View_RepairType>();
     List<object> tempList = DBClient.GetList(view_repairType,new View_RepairTypeMapping(), Constant.CONNSTRING, Where);
     foreach (object tempobject in tempList)
     {
         returnList.Add((View_RepairType)tempobject);
     }
     return returnList;
 }
Пример #2
0
 /// <summary>
 /// 根据编号获取实体
 /// </summary>
 /// <param name="view_repairType">传入的实体,必须含有编号,根据编号获取</param>
 /// <returns>返回得到的实体</returns>
 public static View_RepairType Get(View_RepairType view_repairType)
 {
     return (View_RepairType)DBClient.Get(view_repairType, new View_RepairTypeMapping(), Constant.CONNSTRING);
 }
Пример #3
0
        public static bool PostMessage(View_OrderList view_orderlist)
        {
            //商品名称,服务时间,师傅姓名,客户姓名,收费标准,区域 ,备注
            //User user = new User();
            //user.UserID = view_orderlist.UserID;
            //user = UserBLL.Get(user);

            //筛选符合条件的师傅的openid
            //List<string> openidlist = GetOpenidList(view_orderlist.RepairTypeID, view_orderlist.AddressID);

            //获取farepairname,grrepairname,areaname,faareaname
            View_RepairType view_RepairType = new View_RepairType();
            view_RepairType.RepairTypeID = view_orderlist.RepairTypeID;
            view_RepairType = View_RepairTypeBLL.Get(view_RepairType);
            Address address = new Address();
            address.AddressID =view_orderlist.AddressID;
            address= AddressBLL.Get(address);
            View_Area view_area = new View_Area();
            view_area.AreaID=address.AreaID;
            view_area= View_AreaBLL.Get(view_area);

            DataTable datatable = UserBLL.GetOpenidList();
            foreach (DataRow openid in datatable.Rows)
            {
                string template_id = ConfigurationManager.AppSettings["template_id"];
                string link = ConfigurationManager.AppSettings["orderdetaillink"] + "?orderid=" + view_orderlist.OrderID;//订单详情
                string errcode = string.Empty;
                StringBuilder postDataStr = new StringBuilder();
                postDataStr.Append("{");
                postDataStr.Append("\"touser\":\"" + openid[0].ToString() + "\",\"template_id\":\"" + template_id + "\",\"url\":\"" + link + "\",\"topcolor\":\"#FF0000\",");//
               //postDataStr.Append("\"touser\":\"" + "oIAqTs8mJhDNLz5PekTH_ad_KZLY" + "\",\"template_id\":\"" + template_id + "\",\"url\":\"" + link + "\",\"topcolor\":\"#FF0000\",");//
                postDataStr.Append("\"data\":");
                postDataStr.Append("{");//data{}
                postDataStr.Append("\"first\": {\"value\": \"" + "您好,您有新的派单信息..." + "\",\"color\": \"#173177\"},");
                postDataStr.Append("\"keyword1\": {\"value\": \"" + view_RepairType.GrRepairName+"-"+view_RepairType.FaRepairName+"-"+view_orderlist.RepairName + "\",\"color\": \"#173177\"},");
                postDataStr.Append("\"keyword2\": {\"value\": \"" + view_orderlist.WorkTime + "\",\"color\": \"#173177\"},");
                postDataStr.Append("\"keyword3\": {\"value\":\"" + view_orderlist.CustomName + "\", \"color\": \"#173177\"},");
                postDataStr.Append("\"keyword4\": {\"value\": \"" +view_area.FaAreaName+"-"+view_area.AreaName+"-"+ view_orderlist.AddressName + "\",\"color\": \"#173177\"},");
                postDataStr.Append("\"remark\": {\"value\": \"" +"备注:"+ view_orderlist.Note+"     "+view_orderlist.SysNote+ "\",\"color\": \"#173177\"}");
                postDataStr.Append("}");//data结尾
                postDataStr.Append("}");
                string Url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + GetAccessToken();
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
                request.Method = "POST";
                Stream myRequestStream = request.GetRequestStream();
                StreamWriter myStreamWriter = new StreamWriter(myRequestStream);
                myStreamWriter.Write(postDataStr);
                myStreamWriter.Close();

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream myResponseStream = response.GetResponseStream();
                StreamReader myStreamReader = new StreamReader(myResponseStream);
                string strResult = myStreamReader.ReadToEnd();
                myStreamReader.Close();
                myResponseStream.Close();

                if (!strResult.Contains("errorcode"))
                {
                    strResult = "[" + strResult + "]";
                    DataTable dt = JsonHelper.JsonToDataTable(strResult);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        errcode = dt.Rows[0]["errcode"].ToString();
                    }
                }

                if (errcode == "0") {
                    Common.Utils.WriteLog(openid[0].ToString()+ "---" + view_orderlist.OrderID);
                }
                else
                {

                }
            }

            Order order = new Order();
            order.OrderID = view_orderlist.OrderID;
            order = Business.OrderBLL.Get(order);
            order.Status = 2;
            bool bl = Business.OrderBLL.Save(order);
            return bl;
        }
Пример #4
0
 /// <summary>
 /// 添加实体
 /// </summary>
 /// <param name="view_repairType">传入的实体</param>
 /// <returns>操作数据库时返回的操作行数,如果大于 "0" 则返回 true 否则返回 false</returns>
 public static bool Add(View_RepairType view_repairType)
 {
     return DBClient.Add(view_repairType, new View_RepairTypeMapping(), Constant.CONNSTRING);
 }
Пример #5
0
 /// <summary>
 /// 修改实体
 /// </summary>
 /// <param name="view_repairType">传入的实体</param>
 /// <returns>操作数据库时返回的操作行数,如果大于 "0" 则返回 true 否则返回 false</returns>
 public static bool Save(View_RepairType view_repairType)
 {
     return View_RepairTypeDAL.Save(view_repairType);
 }
Пример #6
0
 /// <summary>
 /// 移除实体(根据实体编号移除一条记录)
 /// </summary>
 /// <param name="view_repairType">传入的实体,必须含有编号</param>
 /// <returns>操作数据库时返回的操作行数,如果大于 "0" 则返回 true 否则返回 false</returns>
 public static bool Remove(View_RepairType view_repairType)
 {
     return View_RepairTypeDAL.Remove(view_repairType);
 }
Пример #7
0
 /// <summary>
 /// 获取列表(根据查询条件获取全部列表)
 /// </summary>
 /// <param name="view_repairType">传入的实体,可以是一个空实体</param>
 /// <param name="Where">SQL拼接的查询条件字条串,例如: " ID < 100 " </param>
 /// <returns>返回实体列表</returns>
 public static List<View_RepairType> GetList(View_RepairType view_repairType, string Where)
 {
     return View_RepairTypeDAL.GetList(view_repairType, Where);
 }
Пример #8
0
 /// <summary>
 /// 根据编号获取实体
 /// </summary>
 /// <param name="view_repairType">传入的实体,必须含有编号,根据编号获取</param>
 /// <returns>返回得到的实体</returns>
 public static View_RepairType Get(View_RepairType view_repairType)
 {
     return View_RepairTypeDAL.Get(view_repairType);
 }
Пример #9
0
 /// <summary>
 /// 添加实体
 /// </summary>
 /// <param name="view_repairType">传入的实体</param>
 /// <returns>操作数据库时返回的操作行数,如果大于 "0" 则返回 true 否则返回 false</returns>
 public static bool Add(View_RepairType view_repairType)
 {
     return View_RepairTypeDAL.Add(view_repairType);
 }