Esempio n. 1
0
        public override BaseSearchModel Insert()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                //修改条码中对应装箱ID信息
                ModelAdo<RWBarcodeModel> apiBarcode = new ModelAdo<RWBarcodeModel>();
                //添加历史记录
                ModelAdo<RWHistoryModel> adoBarcodeHistroy = new ModelAdo<RWHistoryModel>();
                foreach (RWBarcodeModel item in RWBarcodeModels)
                {
                    item.BoxID = packingModel.ID;
                    apiBarcode.Update(item);

                    //创建条码历史记录【Add】
                    RWHistoryModel historyModel = new RWHistoryModel()
                    {
                        CreateTime = DateTime.Now,
                        BillID = "",
                        BarcodeID = item.ID,
                        Remark = Remark
                    };
                    adoBarcodeHistroy.Insert(historyModel);
                }

                //修改barcode的条码状态
                ModelAdo<PackingModel> apiPacking = new ModelAdo<PackingModel>();
                packingModel.Status = 2;
                apiPacking.Update(packingModel);

                ts.Complete();
            }
            return this;
        }
Esempio n. 2
0
        public override int Update(BaseSearchModel model)
        {
            try
            {
                foreach (RWBarcodeModel item in RWBarcodeModels)
                {
                    //修改条码信息
                    ModelAdo<RWBarcodeModel> adoBarcode = new ModelAdo<RWBarcodeModel>();
                    item.Status = Status;
                    adoBarcode.Update(item);

                    //添加条码历史记录
                    ModelAdo<RWHistoryModel> adoBarcodeHistroy = new ModelAdo<RWHistoryModel>();
                    RWHistoryModel historyModel = new RWHistoryModel()
                    {
                        CreateTime = DateTime.Now,
                        BillID = "",
                        BarcodeID = item.ID,
                        Remark = Remark
                    };
                    adoBarcodeHistroy.Insert(historyModel);
                }
            }
            catch (Exception)
            {
                return 0;
            }

            return 1;
        }
Esempio n. 3
0
        /// <summary>
        /// token 信息,修改token详细信息
        /// </summary>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        public int updateToken(UserTokenModel model)
        {
            int obj = 0;

            userTokenModel = new ModelAdo <Model.UserTokenModel>();
            UserTokenModel token = userTokenModel.GetModel(" uid =?uid ", "", new MySqlParameter("?uid", model.uid));

            if (token != null)
            {
                model.id = token.id;
                obj      = userTokenModel.Update(model);
            }
            else
            {
                obj = userTokenModel.Insert(model);
            }
            return(obj);
        }
        public override void OnLoad(HttpContext context)
        {
            base.OnLoad(context);
            requestBody             = new RequestBody();
            requestBody.accessToken = context.Request["accessToken"];
            requestBody.oid         = context.Request["oid"];
            requestBody.action      = Convert.ToInt32(context.Request["action"]);
            requestBody.amount      = Convert.ToDecimal(context.Request["money"]);
            if (requestBody.accessToken == null || requestBody.accessToken.Trim().Length == 0 || requestBody.oid.Length == 0 || requestBody.action == 0)
            {
                SystemResponse.Output(SystemResponse.TYPE_NULLPARAMETER, out statusCode, out responseJson);
            }
            else if (requestBody.action == 2 && requestBody.amount == 0)
            {
                SystemResponse.Output(SystemResponse.TYPE_NULLPARAMETER, out statusCode, out responseJson);
            }
            else
            {
                //验证用户
                TokenHelper    token          = new TokenHelper();
                UserTokenModel userTokenModel = token.getUserToken(requestBody.accessToken);
                if (userTokenModel == null)
                {
                    SystemResponse.Output(SystemResponse.TYPE_EXPIRE, out statusCode, out responseJson);
                }
                else
                {
                    ModelAdo <OrderUserModel> modelAdo = new ModelAdo <OrderUserModel>();

                    //核对有没有供应商已抢单
                    OrderUserModel sendOrder = modelAdo.GetModel(" oid =?oid AND status=2", "",
                                                                 new MySqlParameter("?oid", requestBody.oid));
                    //核对供应商与订单状态
                    OrderUserModel model = modelAdo.GetModel("oid=?oid AND uid=?uid", "",
                                                             new MySqlParameter("?oid", requestBody.oid),
                                                             new MySqlParameter("?uid", userTokenModel.uid));
                    //数据是否存在派单中间表
                    if (model != null)
                    {
                        #region 供应商确认抢单【派单中间表已存在,并且订单状态为2,派单中】
                        if (2 == requestBody.action && sendOrder == null)
                        {
                            model.status     = 2;
                            model.amount     = requestBody.amount;
                            model.createTime = StringHelper.ConvertDateTimeInt(DateTime.Now);
                            model.remark     = "被供应商抢单的订单";

                            //修改订单状态为3,并录入相关抢单数据
                            ModelAdo <OrderModel> orderModelAdo = new ModelAdo <OrderModel>();
                            OrderModel            orderModel    = orderModelAdo.GetModel("id=?id", "",
                                                                                         new MySqlParameter("?id", requestBody.oid)
                                                                                         );
                            if (orderModel != null)
                            {
                                orderModel.ostatus    = 3;
                                orderModel.sendUid    = Convert.ToInt32(userTokenModel.uid);
                                orderModel.sendTime   = model.createTime;
                                orderModel.sendRemark = "供应商抢单并输入价格 【待处理订单】";
                                orderModel.sendAmount = model.amount;
                                if (orderModelAdo.Update(orderModel) >= 1)
                                {
                                    if (modelAdo.Update(model) >= 1)
                                    {
                                        SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                                    }
                                    else
                                    {
                                        SystemResponse.Output(SystemResponse.TYPE_ERROR, out statusCode, out responseJson);
                                    }
                                }
                            }
                            else
                            {
                                SystemResponse.Output(SystemResponse.TYPE_ERROR, out statusCode, out responseJson);
                            }
                        }
                        #endregion
                        #region 用户退回订单 【派单中间表已存在,并且订单状态为3,待处理订单】
                        else if (3 == requestBody.action && sendOrder != null && sendOrder.uid == Convert.ToInt32(userTokenModel.uid))
                        {
                            //修改订单状态为2,并清除相关抢单数据
                            ModelAdo <OrderModel> orderModelAdo = new ModelAdo <OrderModel>();
                            OrderModel            orderModel    = orderModelAdo.GetModel("id=?id", "",
                                                                                         new MySqlParameter("?id", requestBody.oid)
                                                                                         );
                            if (orderModel != null)
                            {
                                orderModel.ostatus    = 2;
                                orderModel.sendUid    = 0;
                                orderModel.sendTime   = 0;
                                orderModel.sendRemark = "供应商退回抢单【派单中】";
                                orderModel.sendAmount = 0;
                                if (orderModelAdo.Update(orderModel) >= 1)
                                {
                                    model.status = 3;
                                    model.remark = "被供应商退回的订单";
                                    modelAdo.Update(model);
                                    SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                                }
                                else
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_NO_PERMISSON, out statusCode, out responseJson);
                                }
                            }
                            else
                            {
                                SystemResponse.Output(SystemResponse.TYPE_ERROR, out statusCode, out responseJson);
                            }
                        }
                        #endregion
                        #region 其他操作
                        else
                        {
                            SystemResponse.Output(SystemResponse.TYPE_NO_PERMISSON, out statusCode, out responseJson);
                        }
                        #endregion
                    }
                    else
                    {
                        SystemResponse.Output(SystemResponse.TYPE_NO_PERMISSON, out statusCode, out responseJson);
                    }
                }
            }
        }
        public override void OnLoad(HttpContext context)
        {
            base.OnLoad(context);
            requestBody             = new RequestBody();
            requestBody.accessToken = context.Request["accessToken"];
            requestBody.oid         = context.Request["oid"];
            requestBody.action      = Convert.ToInt32(context.Request["action"]);
            if (requestBody.accessToken == null || requestBody.accessToken.Trim().Length == 0 || requestBody.oid.Length == 0 || requestBody.action == 0)
            {
                SystemResponse.Output(SystemResponse.TYPE_NULLPARAMETER, out statusCode, out responseJson);
            }
            else
            {
                //验证用户
                TokenHelper    token          = new TokenHelper();
                UserTokenModel userTokenModel = token.getUserToken(requestBody.accessToken);
                if (userTokenModel == null)
                {
                    SystemResponse.Output(SystemResponse.TYPE_EXPIRE, out statusCode, out responseJson);
                }
                else
                {
                    #region 客服取消供应商抢单数据、修改订单状态回派单中
                    if (requestBody.action == 2)
                    {
                        //获取当前订单信息
                        ModelAdo <OrderModel> modelAdo = new ModelAdo <OrderModel>();
                        OrderModel            order    = modelAdo.GetModel("id=?oid AND ostatus=?ostatus", "",
                                                                           new MySqlParameter("?oid", requestBody.oid),
                                                                           new MySqlParameter("?ostatus", 3));
                        if (order != null)
                        {
                            //获取派单供应商对应订单中间表数据
                            ModelAdo <OrderUserModel> ouModelAdo = new ModelAdo <OrderUserModel>();
                            OrderUserModel            orderUser  = ouModelAdo.GetModel("oid=?oid AND uid=?uid", "",
                                                                                       new MySqlParameter("?oid", requestBody.oid),
                                                                                       new MySqlParameter("?uid", order.sendUid));
                            orderUser.amount     = 0;
                            orderUser.remark     = "被供应商退回抢单数据";
                            orderUser.createTime = 0;
                            orderUser.status     = 1;
                            if (ouModelAdo.Update(orderUser) >= 1)
                            {
                                order.ostatus    = 2;
                                order.sendUid    = 0;
                                order.sendTime   = 0;
                                order.sendRemark = "被供应商退回抢单数据";
                                order.sendAmount = 0;
                                if (modelAdo.Update(order) >= 1)
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                                }
                                else
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                                }
                            }
                        }
                        else
                        {
                            SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                        }
                    }
                    #endregion

                    #region 客服确认供应商抢单数据
                    else if (requestBody.action == 4)
                    {
                        //获取当前订单信息
                        ModelAdo <OrderModel> modelAdo = new ModelAdo <OrderModel>();
                        OrderModel            order    = modelAdo.GetModel("id=?oid AND ostatus=?ostatus", "",
                                                                           new MySqlParameter("?oid", requestBody.oid),
                                                                           new MySqlParameter("?ostatus", 3));
                        order.ostatus    = 4;
                        order.sendRemark = "客服确认供应商抢单数据";
                        if (order != null)
                        {
                            if (modelAdo.Update(order) >= 1)
                            {
                                //删除派单供应商对应订单中间表数据
                                ModelAdo <OrderUserModel> ouModelAdo = new ModelAdo <OrderUserModel>();
                                int delCount = ouModelAdo.ExecuteSql("DELETE FROM ct_order_user WHERE oid=?oid",
                                                                     new MySqlParameter("?oid", requestBody.oid));
                                if (delCount >= 1)
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                                }
                                else
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                                }
                            }
                        }
                        else
                        {
                            SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                        }
                    }
                    #endregion

                    #region 客服确认关闭已确认数据
                    else if (requestBody.action == 5)
                    {
                        //获取当前订单信息
                        ModelAdo <OrderModel> closeModelAdo = new ModelAdo <OrderModel>();
                        OrderModel            closeOrder    = closeModelAdo.GetModel("id=?oid AND ostatus=?ostatus", "",
                                                                                     new MySqlParameter("?oid", requestBody.oid),
                                                                                     new MySqlParameter("?ostatus", 4));
                        closeOrder.ostatus    = 5;
                        closeOrder.sendRemark = "客服确认完成订单数据";
                        if (closeOrder != null)
                        {
                            if (closeModelAdo.Update(closeOrder) >= 1)
                            {
                                SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);

                                //删除派单供应商对应订单中间表数据
                                ModelAdo <OrderUserModel> ouModelAdo = new ModelAdo <OrderUserModel>();
                                int delCount = ouModelAdo.ExecuteSql("DELETE FROM ct_order_user WHERE oid=?oid",
                                                                     new MySqlParameter("?oid", requestBody.oid));
                                //if (delCount >= 1)
                                //{
                                //}
                                //else
                                //{
                                //}
                            }
                            else
                            {
                                SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                            }
                        }
                        else
                        {
                            SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                        }
                    }
                    #endregion

                    #region 其他
                    else
                    {
                        SystemResponse.Output(SystemResponse.TYPE_NULLPARAMETER, out statusCode, out responseJson);
                    }
                    #endregion
                }
            }
        }
Esempio n. 6
0
        public override void OnLoad(HttpContext context)
        {
            base.OnLoad(context);
            requestBody             = new RequestBody();
            requestBody.accessToken = context.Request["accessToken"];
            requestBody.withId      = Convert.ToInt32(context.Request["withId"]);
            requestBody.page        = Convert.ToInt32(context.Request["page"]);
            requestBody.pageSize    = Convert.ToInt32(context.Request["pageSize"]);

            if (requestBody.accessToken == null || requestBody.accessToken.Trim().Length == 0 || requestBody.withId == 0)
            {
                SystemResponse.Output(SystemResponse.TYPE_NULLPARAMETER, out statusCode, out responseJson);
            }
            else
            {
                //验证用户
                TokenHelper    token          = new TokenHelper();
                UserTokenModel userTokenModel = token.getUserToken(requestBody.accessToken);
                if (userTokenModel == null)
                {
                    SystemResponse.Output(SystemResponse.TYPE_EXPIRE, out statusCode, out responseJson);
                }
                else
                {
                    //获取消息列表
                    ModelAdo <MsgModel> modelAdo = new ModelAdo <MsgModel>();
                    int pagenumber = requestBody.page == 0 ? 1 : requestBody.page;
                    int totalCount = 1;
                    modelAdo.PageSize = requestBody.pageSize == 0 ? modelAdo.PageSize : requestBody.pageSize;

                    List <MsgModel> models = models = modelAdo.GetList(pagenumber,
                                                                       "(ufrom=?ufrom AND uto=?uto) or (uto=?ufrom AND ufrom=?uto)", "createTime DESC ", out totalCount, "",
                                                                       new MySqlParameter("?ufrom", userTokenModel.uid),
                                                                       new MySqlParameter("?uto", requestBody.withId)
                                                                       );
                    if (models.Count >= 1)
                    {
                        //构建返回对象
                        List <Msg> msgs = new List <Msg>();
                        models.Sort(new idComparer());
                        foreach (MsgModel model in models)
                        {
                            Msg msg = new Msg();
                            msg.id         = model.id;
                            msg.content    = model.content;
                            msg.createTime = string.Format("{0:yyyy/MM/dd HH:mm:ss}", StringHelper.GetNomalTime(model.createTime));
                            msg.ufrom      = model.ufrom;
                            msg.uto        = model.uto;
                            msg.type       = model.type;
                            msg.status     = model.status;
                            msgs.Add(msg);
                            //处理数据为已读
                            if (msg.status == 0)
                            {
                                model.status = 1;
                                modelAdo.Update(model);
                            }
                        }
                        responseBody = new ResponseBody
                        {
                            page      = 1,
                            pageTotal = (totalCount + modelAdo.PageSize - 1) / modelAdo.PageSize,
                            total     = totalCount,
                            msgs      = msgs
                        };
                        responseJson = JsonConvert.SerializeObject(responseBody, Formatting.Indented);
                    }
                    else
                    {
                        SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                    }
                }
            }
        }
Esempio n. 7
0
        public override void OnLoad(HttpContext context)
        {
            base.OnLoad(context);
            requestBody             = new RequestBody();
            requestBody.accessToken = context.Request["accessToken"];
            requestBody.uTo         = Convert.ToInt32(context.Request["to"]);
            requestBody.content     = context.Request["content"];

            if (requestBody.content.Length == 0 || requestBody.accessToken.Trim().Length == 0 || requestBody.uTo == 0)
            {
                SystemResponse.Output(SystemResponse.TYPE_NULLPARAMETER, out statusCode, out responseJson);
            }
            else
            {
                //验证用户
                TokenHelper    token     = new TokenHelper();
                UserTokenModel fromModel = token.getUserToken(requestBody.accessToken);
                UserTokenModel toModel   = token.getUserToken(requestBody.uTo);
                if (fromModel == null)
                {
                    SystemResponse.Output(SystemResponse.TYPE_EXPIRE, out statusCode, out responseJson);
                }
                else
                {
                    int msgstatus = 0;

                    #region 入库至本地
                    ModelAdo <MsgModel> modelAdo = new ModelAdo <MsgModel>();
                    MsgModel            msg      = new MsgModel();
                    msg.ufrom      = Convert.ToInt32(fromModel.uid);
                    msg.uto        = requestBody.uTo;
                    msg.content    = requestBody.content;
                    msg.createTime = StringHelper.ConvertDateTimeInt(DateTime.Now);
                    msg.status     = msgstatus;
                    if (modelAdo.Insert(msg) >= 1)
                    {
                        #region 百度推送
                        if (toModel != null && toModel.bpuserId.Length >= 1 && toModel.channelId.Length >= 1)
                        {
                            //获取插入本地数据
                            MsgModel msgPush = modelAdo.GetModel("ufrom=?ufrom AND uto=?uto AND createTime=?createTime AND status=0", "",
                                                                 new MySqlParameter("?ufrom", msg.ufrom),
                                                                 new MySqlParameter("?uto", msg.uto),
                                                                 new MySqlParameter("?createTime", msg.createTime));
                            if (msgPush != null)
                            {
                                try
                                {
                                    //百度配置信息
                                    string secretKey    = ConfigurationManager.AppSettings["baidu_secret_key"];
                                    string apiKey       = ConfigurationManager.AppSettings["baidu_api_key"];
                                    uint   depolyStatus = uint.Parse(ConfigurationManager.AppSettings["baidu_depoly_status"]);

                                    String    messages     = "";
                                    TimeSpan  ts           = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
                                    uint      unixTime     = (uint)ts.TotalSeconds;
                                    string    messageksy   = "api";
                                    uint      message_type = 1;
                                    BaiduPush Bpush        = new BaiduPush("POST", secretKey);



                                    if (toModel.deviceType == 1)
                                    {
                                        message_type       = 1;
                                        toModel.deviceType = 4;
                                        IOSNotification notifaction = new IOSNotification();
                                        notifaction.id         = msgPush.id;
                                        notifaction.ufrom      = msgPush.ufrom;
                                        notifaction.uto        = msgPush.uto;
                                        notifaction.content    = msgPush.content.Trim();
                                        notifaction.createTime = string.Format("{0:yyyy/MM/dd HH:mm:ss}", System.DateTime.Now);
                                        notifaction.type       = msgPush.type;
                                        notifaction.status     = 1;
                                        IOSAPS aps = new IOSAPS()
                                        {
                                            alert = "收到一条新消息",
                                        };
                                        notifaction.aps = aps;
                                        messages        = notifaction.getJsonString();
                                    }
                                    else
                                    {
                                        message_type       = 0;
                                        toModel.deviceType = 3;
                                        BaiduPushNotification notifaction = new BaiduPushNotification();
                                        notifaction.title = "";
                                        //构建custom_content信息
                                        BaiduDescription bdMsg = new BaiduDescription();
                                        bdMsg.id                   = msgPush.id;
                                        bdMsg.ufrom                = msgPush.ufrom;
                                        bdMsg.uto                  = msgPush.uto;
                                        bdMsg.content              = msgPush.content;
                                        bdMsg.createTime           = string.Format("{0:yyyy/MM/dd HH:mm:ss}", System.DateTime.Now);
                                        bdMsg.type                 = msgPush.type;
                                        bdMsg.status               = 1;
                                        notifaction.description    = "收到一条新消息";
                                        notifaction.custom_content = bdMsg;
                                        messages                   = notifaction.getJsonString();
                                    }



                                    PushOptions pOpts = new PushOptions("push_msg", apiKey, toModel.bpuserId.ToString(),
                                                                        toModel.channelId.ToString(), Convert.ToUInt32(toModel.deviceType), messages, messageksy, unixTime);
                                    pOpts.message_type  = message_type;
                                    pOpts.deploy_status = depolyStatus;
                                    pOpts.push_type     = 1;
                                    string response = Bpush.PushMessage(pOpts);
                                    responseJson = response;
                                    msgstatus    = 1;

                                    //处理数据为已读
                                    if (msg.status == 0)
                                    {
                                        msgPush.status = 1;
                                        modelAdo.Update(msgPush);
                                    }

                                    //SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                                    //responseJson = strBDMsg;
                                }
                                catch (Exception ex)
                                {
                                    responseJson = ex.ToString();
                                    SystemResponse.Output(SystemResponse.TYPE_ERROR, out statusCode, out responseJson);
                                }
                            }
                            #endregion
                        }
                        else
                        {
                            SystemResponse.Output(SystemResponse.TYPE_ERROR, out statusCode, out responseJson);
                        }
                        #endregion
                    }
                }
            }
        }
Esempio n. 8
0
        public override void OnLoad(HttpContext context)
        {
            base.OnLoad(context);
            requestBody             = new RequestBody();
            requestBody.accessToken = context.Request["accessToken"];
            requestBody.oid         = context.Request["oid"];
            requestBody.uid         = context.Request["uid"];
            if (requestBody.accessToken == null || requestBody.accessToken.Trim().Length == 0 || requestBody.oid.Length == 0 || requestBody.uid.Length == 0)
            {
                SystemResponse.Output(SystemResponse.TYPE_NULLPARAMETER, out statusCode, out responseJson);
            }
            else
            {
                List <int> values = JsonConvert.DeserializeObject <List <int> >(requestBody.uid);

                //验证用户
                TokenHelper    token          = new TokenHelper();
                UserTokenModel userTokenModel = token.getUserToken(requestBody.accessToken);
                if (userTokenModel == null)
                {
                    SystemResponse.Output(SystemResponse.TYPE_EXPIRE, out statusCode, out responseJson);
                }
                else
                {
                    //获取订单表数据
                    ModelAdo <OrderModel> modelAdoOrder = new ModelAdo <OrderModel>();
                    OrderModel            orderModel    = modelAdoOrder.GetModel("(id=?id AND ostatus=?ostatus) or (id=?id AND ostatus=?ostatus1) ", "",
                                                                                 new MySqlParameter("?id", requestBody.oid),
                                                                                 new MySqlParameter("?ostatus", 2),
                                                                                 new MySqlParameter("?ostatus1", 1));

                    if (orderModel != null)
                    {
                        ModelAdo <OrderUserModel> modelAdo = new ModelAdo <OrderUserModel>();
                        int existCount = modelAdo.GetRecordCount("oid=?oid",
                                                                 new MySqlParameter("?oid", requestBody.oid));
                        if (existCount >= 1)
                        {
                            int delCount = modelAdo.ExecuteSql("DELETE FROM ct_order_user WHERE oid=?oid",
                                                               new MySqlParameter("?oid", requestBody.oid));
                            if (delCount >= 1)
                            {
                                StringBuilder sbValues = new StringBuilder();
                                sbValues.Append(" INSERT INTO ct_order_user(oid,uid,status,remark) VALUES ");
                                for (int i = 0; i < values.Count; i++)
                                {
                                    sbValues.Append("(" + requestBody.oid + "," + values[i] + ",1,'派送中的订单'),");
                                }
                                sbValues.Remove(sbValues.Length - 1, 1).Append(";");
                                int inCount = modelAdo.ExecuteSql(sbValues.ToString());
                                if (inCount >= 1)
                                {
                                    if (orderModel != null)
                                    {
                                        orderModel.ostatus = 2;
                                        modelAdoOrder.Update(orderModel);
                                    }
                                    SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                                }
                                else
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                                }
                            }
                            else
                            {
                                SystemResponse.Output(SystemResponse.TYPE_ERROR, out statusCode, out responseJson);
                            }
                        }
                        else
                        {
                            StringBuilder sbValues = new StringBuilder();
                            sbValues.Append(" INSERT INTO ct_order_user(oid,uid,status) VALUES ");
                            for (int i = 0; i < values.Count; i++)
                            {
                                sbValues.Append("(" + requestBody.oid + "," + values[i] + ",1),");
                            }
                            sbValues.Remove(sbValues.Length - 1, 1).Append(";");
                            int inCount = modelAdo.ExecuteSql(sbValues.ToString());
                            if (inCount >= 1)
                            {
                                SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                            }
                            else
                            {
                                SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                            }
                        }
                    }
                    else
                    {
                        SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                    }
                }
            }
        }
Esempio n. 9
0
 public override int Delete(string id)
 {
     ModelAdo<LoginHistoryModel> adoLHM = new ModelAdo<LoginHistoryModel>();
     LoginHistoryModel lhm = adoLHM.GetModelByID(id);
     if (lhm != null)
     {
         lhm.LoginStatus = 0;
         lhm.LogoutTime = DateTime.Now;
         return adoLHM.Update(lhm);
     }
     else
         return 0;
 }