Beispiel #1
0
    /// <summary>
    /// 订单分配
    /// </summary>
    public void InstallerAssign()
    {
        var json = Request["data"];
        var rows = (ArrayList)PluSoft.Utils.JSON.Decode(json);

        foreach (Hashtable row in rows)
        {
            var orderId     = Convert.ToInt32(row["OrderId"]);
            var detailCount = new Sys.BLL.OrderStatusFlow().GetRecordCount("OrderId=" + orderId);
            if (detailCount > 0)
            {
                Response.Write("-1");
                return;
            }
            else
            {
                var model = new Sys.BLL.Orders().GetModel(orderId);
                if (model != null)
                {
                    model.WorkerId = row["newWorkerId"].ToString();
                    var result = new Sys.BLL.Orders().Update(model);
                    if (result)
                    {
                        Response.Write("1");
                    }
                }
            }
        }
    }
Beispiel #2
0
    public void GetView()
    {
        int id     = PageRequest.GetInt("id", 0);
        var dt     = new Sys.BLL.Orders().GetOrderByOrderId(id);
        var data   = MyDBUtils.DataTable2ArrayList(dt);
        var htData = data.Count > 0 ? (Hashtable)data[0] : null;
        var json   = PluSoft.Utils.JSON.Encode(htData);

        Response.Write(json);
    }
Beispiel #3
0
    public void DelOrder()
    {
        int id  = PageRequest.GetInt("id", 0);
        var bll = new Sys.BLL.Orders();

        if (bll.DeleteOrders(id))
        {
            Response.Write("1");
        }
        else
        {
            Response.Write("0");
        }
    }
Beispiel #4
0
    /// <summary>
    /// 更新订单
    /// </summary>
    /// <returns></returns>
    public Dictionary <string, object> UpdateOrdersStatus()
    {
        Dictionary <string, object> dicResult = new Dictionary <string, object>();

        if (!Request.Params.AllKeys.Contains("ordersId") ||
            !Request.Params.AllKeys.Contains("orderStatus") || !Request.Params.AllKeys.Contains("staFlag") ||
            !Request.Params.AllKeys.Contains("staMessage"))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "接口缺少参数!");
            return(dicResult);
        }

        var token       = Request["token"];
        var ordersId    = Convert.ToInt32(Request["ordersId"]);
        var orderStatus = Convert.ToInt32(Request["orderStatus"]);
        var staFlag     = Convert.ToInt32(Request["staFlag"]);
        var staMessage  = Request["staMessage"];

        //var picList = Request["PicList"];
        if (!new Sys.BLL.Account().CheckToken(token))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "Token验证失败!");
            return(dicResult);
        }

        string message;
        var    bllOrder = new Sys.BLL.Orders();

        if (!bllOrder.OrdersStatusCheck(ordersId, orderStatus, staFlag, out message))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", message);
        }
        else
        {
            var picList = UploadPhotos();
            var result  = bllOrder.UpdateOrdersStatus(ordersId, orderStatus, staFlag, picList, staMessage);
            if (result)
            {
                dicResult.Add("response_id", 1);
                dicResult.Add("response_msg", "订单状态更新成功!");
            }
        }

        return(dicResult);
    }
Beispiel #5
0
    /// <summary>
    /// 创建订单
    /// </summary>
    /// <param name="dicParams"></param>
    /// <returns></returns>
    private Dictionary <string, object> CreateOrders(Dictionary <string, object> dicParams)
    {
        Dictionary <string, object> dicResult = new Dictionary <string, object>();

        if (!dicParams.ContainsKey("orders") || !dicParams.ContainsKey("orders_type") || !dicParams.ContainsKey("token"))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "登陆接口缺少参数!");
            return(dicResult);
        }
        if (!new Sys.BLL.Account().CheckToken(dicParams["token"].ToString()))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "Token验证失败!");
            return(dicResult);
        }

        var ds = new DataSet();

        ds.Tables.Add(JsonHelper.JsonToDataTable(dicParams["orders"].ToString()));
        ds.Tables.Add(JsonHelper.JsonToDataTable(dicParams["orders_type"].ToString()));
        var ordersList    = JsonHelper.DataSetToIList <Sys.Model.Orders>(ds, 0);
        var orderTypeList = JsonHelper.DataSetToIList <Sys.Model.OrderType>(ds, 1);

        if (ordersList == null || orderTypeList == null)
        {
            // 失败,返回信息
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "创建失败!");
        }
        else
        {
            bool result = new Sys.BLL.Orders().CreateOrders(ordersList, orderTypeList);
            if (result)
            {
                dicResult.Add("response_id", 1);
                dicResult.Add("response_msg", "订单创建成功!");
            }
            else
            {
                dicResult.Add("response_id", 0);
                dicResult.Add("response_msg", "订单创建失败!");
            }
        }

        return(dicResult);
    }
Beispiel #6
0
    /// <summary>
    /// 更新订单
    /// </summary>
    /// <param name="dicParams"></param>
    /// <returns></returns>
    public Dictionary <string, object> UpdateOrdersStatus(Dictionary <string, object> dicParams)
    {
        Dictionary <string, object> dicResult = new Dictionary <string, object>();

        //int ordersId, string orderStatus, int staFlag
        if (!dicParams.ContainsKey("token") || !dicParams.ContainsKey("ordersId") ||
            !dicParams.ContainsKey("orderStatus") || !dicParams.ContainsKey("staFlag") ||
            !dicParams.ContainsKey("PicList") || !dicParams.ContainsKey("staMessage"))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "接口缺少参数!");
            return(dicResult);
        }
        if (!new Sys.BLL.Account().CheckToken(dicParams["token"].ToString()))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "Token验证失败!");
            return(dicResult);
        }
        int    ordersId    = Convert.ToInt32(dicParams["ordersId"]);
        int    orderStatus = Convert.ToInt32(dicParams["orderStatus"]);
        int    staFlag     = Convert.ToInt32(dicParams["staFlag"]);
        string picList     = dicParams["PicList"].ToString();
        string staMessage  = dicParams["staMessage"].ToString();

        string message;
        var    bllOrder = new Sys.BLL.Orders();

        if (!bllOrder.OrdersStatusCheck(ordersId, orderStatus, staFlag, out message))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", message);
        }
        else
        {
            var result = bllOrder.UpdateOrdersStatus(ordersId, orderStatus, staFlag, picList, staMessage);
            if (result)
            {
                dicResult.Add("response_id", 1);
                dicResult.Add("response_msg", "订单状态更新成功!");
            }
        }

        return(dicResult);
    }
Beispiel #7
0
    /// <summary>
    /// 订单列表
    /// </summary>
    /// <param name="dicParams"></param>
    /// <returns></returns>
    private Dictionary <string, object> GetOrdersList(Dictionary <string, object> dicParams)
    {
        Dictionary <string, object> dicResult = new Dictionary <string, object>();

        if (!dicParams.ContainsKey("token") || !dicParams.ContainsKey("orderStatus") ||
            !dicParams.ContainsKey("pageIndex") || !dicParams.ContainsKey("pageSize"))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "接口缺少参数!");
            return(dicResult);
        }
        if (!new Sys.BLL.Account().CheckToken(dicParams["token"].ToString()))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "Token验证失败!");
            return(dicResult);
        }

        var orderStatus = dicParams["orderStatus"].ToString();
        var userType    = dicParams["userType"].ToString();
        var userLoginId = dicParams["userLoginId"].ToString();
        var pageIndex   = Convert.ToInt32(dicParams["pageIndex"]);
        var pageSize    = Convert.ToInt32(dicParams["pageSize"]);
        var dt          = new Sys.BLL.Orders().GetOrdersList(orderStatus, userType, userLoginId, pageIndex, pageSize);

        if (dt == null || dt.Rows.Count == 0)
        {
            // 失败,返回信息
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "暂无数据!");
        }
        else
        {
            dicResult.Add("response_id", 1);
            dicResult.Add("response_msg", "订单信息获取成功!");
            dicResult.Add("orders_info", dt);
        }

        return(dicResult);
    }
Beispiel #8
0
    /// <summary>
    /// 根据UserLoginId获取用户信息和订单信息
    /// </summary>
    /// <param name="dicParams"></param>
    /// <returns></returns>
    private Dictionary <string, object> GetOrdersInfo(Dictionary <string, object> dicParams)
    {
        Dictionary <string, object> dicResult = new Dictionary <string, object>();

        if (!dicParams.ContainsKey("token") || !dicParams.ContainsKey("orderId"))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "接口缺少参数!");
            return(dicResult);
        }
        if (!new Sys.BLL.Account().CheckToken(dicParams["token"].ToString()))
        {
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "Token验证失败!");
            return(dicResult);
        }

        int orderId       = Utils.StrToInt(dicParams["orderId"], 0);
        var orderModel    = new Sys.BLL.Orders().GetModel(orderId);
        var orderTypeList = new Sys.BLL.OrderType().GetModelList("OrderId=" + orderId);
        var orderFlow     = new Sys.BLL.Orders().GetOrderFlowInfo(orderId);

        if (orderModel == null || orderTypeList == null)
        {
            // 失败,返回信息
            dicResult.Add("response_id", 0);
            dicResult.Add("response_msg", "订单明细获取异常!");
        }
        else
        {
            dicResult.Add("response_id", 1);
            dicResult.Add("response_msg", "订单信息获取成功!");
            dicResult.Add("order_main", orderModel);
            dicResult.Add("order_detail", orderTypeList);
            dicResult.Add("order_flow", orderFlow);
        }

        return(dicResult);
    }
Beispiel #9
0
    /// <summary>
    /// 查询
    /// </summary>
    public void SearchData()
    {
        //查询条件
        var orderStatus = PageRequest.GetString("orderStatus");
        var projectName = PageRequest.GetString("projectName");
        var cmbDate     = PageRequest.GetString("cmbDate");
        //分页
        var pageIndex = PageRequest.GetInt("pageIndex", 1) + 1;
        var pageSize  = PageRequest.GetInt("pageSize", 1);
        //字段排序
        var sortField = PageRequest.GetString("sortField");
        var sortOrder = PageRequest.GetString("sortOrder");
        var order     = "";

        if (String.IsNullOrEmpty(sortField) == false)
        {
            if (sortOrder != "desc")
            {
                sortOrder = "asc";
            }
            order = " u." + sortField + " " + sortOrder;
        }
        else
        {
            order += " CreateDate desc";
        }
        var strWhere = "1=1";

        if (!string.IsNullOrEmpty(orderStatus))
        {
            if (orderStatus.Equals("0"))
            {
                strWhere += " and  OrderStatus is null";
            }
            else
            {
                strWhere += " and  OrderStatus=" + orderStatus;
            }
        }
        if (!string.IsNullOrEmpty(projectName))
        {
            strWhere += string.Format(" and ProjectName like '%{0}%' ", DataSecurity.FilterBadChar(projectName));
        }
        if (!string.IsNullOrEmpty(cmbDate))
        {
            //1day,3day,1week,1month,halfyear,oneyear
            if (cmbDate.Equals("1day"))
            {
                strWhere += " and CreateDate>=DATEADD(DAY,-1,GETDATE())";
            }
            else if (cmbDate.Equals("3day"))
            {
                strWhere += " and CreateDate>=DATEADD(DAY,-3,GETDATE())";
            }
            else if (cmbDate.Equals("1week"))
            {
                strWhere += " and CreateDate>=DATEADD(DAY,-7,GETDATE())";
            }
            else if (cmbDate.Equals("1month"))
            {
                strWhere += " and CreateDate>=DATEADD(DAY,-30,GETDATE())";
            }
            else if (cmbDate.Equals("halfyear"))
            {
                strWhere += " and CreateDate>=DATEADD(DAY,-180,GETDATE())";
            }
            else if (cmbDate.Equals("oneyear"))
            {
                strWhere += " and CreateDate>=DATEADD(DAY,-365,GETDATE())";
            }
        }
        if (pageSize == 1)
        {
            pageSize = 100;
        }
        var dt      = new Sys.BLL.Orders().GetListForMoreTable(pageSize, pageIndex, strWhere, order);
        var dataAll = MyDBUtils.DataTable2ArrayList(dt);
        var result  = new Hashtable();

        result["data"] = dataAll;
        var total = new Sys.BLL.Common().GetCount("Orders o", strWhere);

        result["total"] = total;
        //JSON
        var json = PluSoft.Utils.JSON.Encode(result);

        Response.Write(json);
    }