public ActionResult Receive(long id, string openId = "")
        {
            ReceiveModel obj   = ( ReceiveModel )this._iBonusService.Receive(id, openId);
            var          bonus = this._iBonusService.Get(id);
            BonusModel   model = new BonusModel(bonus);

            if (obj.State == ReceiveStatus.CanReceive)
            {
                return(Redirect("/m-weixin/Bonus/Completed/" + model.Id + "?openId=" + openId + "&price=" + obj.Price));
            }
            if (obj.State == ReceiveStatus.CanReceiveNotAttention)
            {
                return(Redirect("/m-weixin/Bonus/CanReceiveNotAttention/" + model.Id + "?openId=" + openId + "&price=" + obj.Price));
            }
            else if (obj.State == ReceiveStatus.Receive)
            {
                return(Redirect("/m-weixin/Bonus/HasReceive/" + model.Id));
            }
            else if (obj.State == ReceiveStatus.HaveNot)
            {
                return(Redirect("/m-weixin/Bonus/HaveNot/" + model.Id));
            }
            else if (obj.State == ReceiveStatus.NotAttention)
            {
                return(Redirect("/m-weixin/Bonus/NotAttention/" + model.Id));
            }
            else if (obj.State == ReceiveStatus.Invalid)
            {
                return(Redirect("/m-weixin/Bonus/Invalid/" + model.Id));
            }
            else
            {
                throw new Exception("领取发生异常");
            }
        }
        public async Task <ActionResult> Receive([FromBody] ReceiveModel receiveModel)
        {
            var bag = await bagRepository.GetBag(receiveModel.BagId);

            if (bag == null)
            {
                return(Ok(new ReceiveResultModel
                {
                    Status = ReceiveStatus.UNKNOWN,
                    BagId = receiveModel.BagId
                }));
            }

            bag.Value           = receiveModel.Value;
            bag.Status          = BagStatus.Recieved;
            bag.ReceiveDate     = DateTime.UtcNow;
            bag.ReceiveLocation = receiveModel.Location;
            bag.Weight          = receiveModel.Weight;

            await bagRepository.AddOrUpdateAsync(bag);

            return(Ok(new ReceiveResultModel
            {
                Status = ReceiveStatus.OK,
                BagId = bag.BagId,
            }));
        }
示例#3
0
        public string GetCars()
        {
            ReceiveModel car = new ReceiveModel();
            string       ans = car.GetCars();

            return(ans);
        }
示例#4
0
        public ActionResult Receive(long id, string openId = "")
        {
            ReceiveModel receiveModel = (ReceiveModel)_bonusService.Receive(id, openId);
            BonusModel   bonusModel   = new BonusModel(_bonusService.Get(id));

            if (receiveModel.State == ReceiveStatus.CanReceive)
            {
                object[] objArray = new object[] { "/m-weixin/Bonus/Completed/", bonusModel.Id, "?openId=", openId, "&price=", receiveModel.Price };
                return(Redirect(string.Concat(objArray)));
            }
            if (receiveModel.State == ReceiveStatus.Receive)
            {
                return(Redirect(string.Concat("/m-weixin/Bonus/HasReceive/", bonusModel.Id)));
            }
            if (receiveModel.State == ReceiveStatus.HaveNot)
            {
                return(Redirect(string.Concat("/m-weixin/Bonus/HaveNot/", bonusModel.Id)));
            }
            if (receiveModel.State == ReceiveStatus.NotAttention)
            {
                return(Redirect(string.Concat("/m-weixin/Bonus/NotAttention/", bonusModel.Id)));
            }
            if (receiveModel.State != ReceiveStatus.Invalid)
            {
                throw new Exception("领取发生异常");
            }
            return(Redirect(string.Concat("/m-weixin/Bonus/Invalid/", bonusModel.Id)));
        }
示例#5
0
 public ActionResult Edit(ReceiveModel model)
 {
     try
     {
         var receive = _receiveService.GetReceiveById(model.Id);
         if (receive == null)
         {
             return(RedirectToAction("List"));
         }
         if (!ModelState.IsValid)
         {
             return(View(model));
         }
         var currentUser = Session[Values.USER_SESSION] as UserModel;
         model.UpdatedBy       = currentUser.Id;
         model.UpdatedDateTime = DateTime.Now;
         _receiveService.UpdateReceive(model);
         SuccessNotification("Update receive information successfully.");
         return(model.ContinueEditing ? RedirectToAction("Edit", new { id = model.Id }) : RedirectToAction("List"));
     }
     catch (Exception e)
     {
         ErrorNotification("Update receive information failed.");
         return(View(model));
     }
 }
示例#6
0
        private void OnCollectionViewSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.CurrentSelection.FirstOrDefault() == null)
            {
                return;
            }
            ReceiveModel   receiver = e.CurrentSelection.FirstOrDefault() as ReceiveModel;
            CollectionView cv       = sender as CollectionView;

            cv.SelectedItem = null;
            CharPageViewModel.AUser CurrentUser = new CharPageViewModel.AUser()
            {
                UserId = App.StaticUser.UserId,
                Name   = App.StaticUser.Name,
                Avatar = App.StaticUser.Imgurl
            };
            CharPageViewModel.AUser sdUser = new CharPageViewModel.AUser()
            {
                UserId = receiver.UserId,
                Name   = receiver.Name,
                Avatar = receiver.Avatar
            };
            string[] msgs = App.Receive[sdUser.UserId].Split('|');
            Navigation.PushAsync(new ChatPage()
            {
                BindingContext = new CharPageViewModel(CurrentUser, sdUser, msgs)
            });
        }
示例#7
0
        public ActionResult ReceiveProduct(ReceiveModel model)
        {
            try
            {
                model.DestinationLocations = locationService.GetLocations(1); //1: Internal
                model.SourceLocations      = locationService.GetExternalLocations();
                model.Products             = productService.GetProductItems(string.Empty);
                //model.TransferComplete = _transferService.TransferOut(model.SelectedProductId,
                //    model.SelectedSourceLocationId, model.SelectedDestinationLocationId, model.SelectedQuantity);

                if (!model.TransferComplete.GetValueOrDefault())
                {
                    ModelState.AddModelError("GENERALERR-1", "Receipt Incomplete. General Error");
                }

                model.SelectedQuantity = 0;
                return(View("Receive", model));
            }
            catch (Exception e)
            {
                ModelState.AddModelError("CAUGHTERR-1", e.Message);
                model.TransferComplete = false;
                return(View("Receive", model));
            }
        }
示例#8
0
        public void InsertReceive(ReceiveModel receiveModel)
        {
            var receive = Mapper.Map <Receive>(receiveModel);

            _shoppingContext.Receives.Add(receive);
            _shoppingContext.SaveChanges();
            receiveModel.Id = receive.Id;
        }
示例#9
0
        public ActionResult Create()
        {
            var model = new ReceiveModel();

            model.DocumentDateTime = DateTime.Now;
            model.CreatedDateTime  = DateTime.Now;
            return(View(model));
        }
示例#10
0
        public ReceiveModel CreateNewReceive(int currentUserId)
        {
            var receive = new ReceiveModel();

            receive.CreatedBy        = currentUserId;
            receive.CreatedDateTime  = DateTime.Now;
            receive.DocumentDateTime = DateTime.Now;
            return(receive);
        }
示例#11
0
 public static ReceiveEntity ToDto(ReceiveModel model)
 {
     return(new ReceiveEntity
     {
         RecOID = model.RecOID,
         EmpID = model.EmpID,
         EmpName = model.EmpName,
         RecODate = model.RecODate,
         RecEnabled = model.RecEnabled,
     });
 }
示例#12
0
        public void UpdateReceive(ReceiveModel receiveModel)
        {
            var receiveUpdated = _shoppingContext.Receives.Find(receiveModel.Id);

            if (receiveUpdated != null)
            {
                receiveUpdated = Mapper.Map <Receive>(receiveModel);
                _shoppingContext.Receives.AddOrUpdate(receiveUpdated);
                _shoppingContext.SaveChanges();
            }
        }
示例#13
0
        public int RecordToCSV(ReceiveModel receiveModel)
        {
            int    returnCode = -1;
            string uuid       = receiveModel.Uuid;
            string sceneName  = receiveModel.Scene;

            SendData[] sendDatas = receiveModel.SendData;
            if (uuid != null && sceneName != null && sendDatas != null)
            {
                returnCode = dataDAL.RecordToCSV(uuid, sceneName, sendDatas);
            }
            return(returnCode);
        }
示例#14
0
 //[AllowAnonymous]
 public ServiceResult <RedPocketDetailOM> Receive(ReceiveModel model)
 {
     lock (_pocketLock)
     {
         //var data = Component.Receive(new UserAccountComponent().GetById(Guid.Parse("D59228E9-52F8-452A-9AFA-AC649C618C02")), model.PassCode);
         var data = Component.Receive(this.GetUser(), model.PassCode, this.IsZH());
         //Guid.Parse("D59228E9-52F8-452A-9AFA-AC649C618C02")
         return(new ServiceResult <RedPocketDetailOM>
         {
             Data = data
         });
     }
 }
示例#15
0
        public void Approved(ReceiveModel receiveModel)
        {
            var receive = _shoppingContext.Receives.Find(receiveModel.Id);

            if (receive == null)
            {
                return;
            }

            receive.ApprovedBy       = receiveModel.ApprovedBy;
            receive.ApprovedDateTime = DateTime.Now;
            receive.Status           = receiveModel.Status;
            AddQuantityIntoProduct(receive);
            _shoppingContext.SaveChanges();
        }
示例#16
0
        public ResponseModel AcquireCoordinates(ReceiveModel receiveModel)
        {
            int           returnCode    = dataBLL.RecordToCSV(receiveModel);
            ResponseModel responseModel = new ResponseModel();

            if (returnCode == 100)
            {
                responseModel.Status = 235;
                responseModel.Msg    = "Store Success";
                return(responseModel);
            }
            else
            {
                responseModel.Status = -100;
                responseModel.Msg    = "Store Fail";
                return(responseModel);
            }
        }
示例#17
0
        public bool Open(ReceiveModel receiveModel)
        {
            var receive = _shoppingContext.Receives.Find(receiveModel.Id);

            if (receive == null)
            {
                return(false);
            }
            receive.ApprovedBy       = receiveModel.ApprovedBy;
            receive.ApprovedDateTime = receiveModel.ApprovedDateTime;
            receive.Status           = receiveModel.Status;
            if (DecreaseQuantityInProduct(receive))
            {
                _shoppingContext.SaveChanges();
                return(true);
            }

            return(false);
        }
示例#18
0
 public ActionResult Create(ReceiveModel model)
 {
     try
     {
         var currentUser = Session[Values.USER_SESSION] as UserModel;
         model.CreatedBy       = currentUser.Id;
         model.CreatedDateTime = DateTime.Now;
         if (!ModelState.IsValid)
         {
             return(View(model));
         }
         _receiveService.InsertReceive(model);
         SuccessNotification("Thêm mới phiếu nhập thành công");
         return(model.ContinueEditing ? RedirectToAction("Edit", new { id = model.Id }) : RedirectToAction("List"));
     }
     catch (Exception e)
     {
         ErrorNotification("Thêm mới phiếu nhập thất bại");
         return(View(model));
     }
 }
示例#19
0
 public ActionResult Create(ReceiveModel model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(View(model));
         }
         if (_receiveService.IsReceiveCodeExisted(model.Code))
         {
             ErrorNotification("Add new receive failed. Receive code is existed.");
             return(View(model));
         }
         _receiveService.InsertReceive(model);
         SuccessNotification("Add new receive successfully.");
         return(model.ContinueEditing ? RedirectToAction("Edit", new { id = model.Id }) : RedirectToAction("List"));
     }
     catch (Exception e)
     {
         ErrorNotification("Add new receive failed.");
         return(View(model));
     }
 }
示例#20
0
 private static void WhatsApp_ReceiveRemainingMessagesEvent(ReceiveModel obj)
 {
     Console.WriteLine($"{obj.StringData}");
 }
示例#21
0
 public ResponseModel AcquireSurveyP1(ReceiveModel receiveModel)
 {
     return(null);
 }
示例#22
0
 public ActionResult ReceiveProduct(ReceiveModel model)
 {
     if (Session["S_EmpID"] != null)
     {
         var resolveRequest = HttpContext.Request;
         resolveRequest.InputStream.Seek(0, SeekOrigin.Begin);
         string        jsonString    = new StreamReader(resolveRequest.InputStream).ReadToEnd();
         List <SERIAL> listOfObjects = new List <SERIAL>();
         if (jsonString != null)
         {
             if (Session["S_EmpID"].ToString() != null)
             {
                 dynamic jArr2 = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonString);
                 try
                 {
                     foreach (dynamic item in jArr2)
                     {
                         foreach (var serial in item.serial)
                         {
                             bool i = true; string temp = "";
                             foreach (var data in serial)
                             {
                                 if (i)
                                 {
                                     temp = data.Value;
                                     i    = false;
                                 }
                                 else
                                 {
                                     listOfObjects.Add(new SERIAL()
                                     {
                                         PrdID = temp, SrlID = data.Value
                                     });
                                 }
                             }
                         }
                         List <ReceiveDetailModel> myDeserializedObjList = item.dataTable.ToObject <List <ReceiveDetailModel> >();
                         model.EmpID    = Session["S_EmpID"].ToString();
                         model.RecODate = System.DateTime.Now.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
                         _receiveRepository.InsertReceive(model, myDeserializedObjList, listOfObjects);
                         return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
                     }
                 }
                 catch
                 {
                     return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
                 }
             }
             return(RedirectToAction("Login2", "Account"));
         }
         return(View());
     }
     else
     {
         return(RedirectToAction("Login2", "Account"));
     }
     //    var resolveRequest = HttpContext.Request;
     //    resolveRequest.InputStream.Seek(0, SeekOrigin.Begin);
     //    string jsonString = new StreamReader(resolveRequest.InputStream).ReadToEnd();
     //    if (jsonString != null)
     //    {
     //      //  List<ReceiveDetailModel> myDeserializedObjList = (List<ReceiveDetailModel>)Newtonsoft.Json.JsonConvert.DeserializeObject(jsonString, typeof(List<ReceiveDetailModel>));
     //        List<ReceiveDetailModel> myDeserializedObjList = item.dataTable.ToObject<List<ReceiveDetailModel>>();
     //        model.EmpID = Session["S_EmpID"].ToString();
     //        model.RecODate = System.DateTime.Now.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
     //        //var map_update = Mapper._ToDto2(myDeserializedObjList);
     //        //_offerRepository.UpdateOffer(map_update, Session["OffID"].ToString(), Session["S_EmpFname"].ToString());
     //        _receiveRepository.InsertReceive(model, myDeserializedObjList);
     //        return Json(new { success = true }, JsonRequestBehavior.AllowGet);
     //    }
     //    return Json(new { success = false }, JsonRequestBehavior.AllowGet);
     //}
     //return RedirectToAction("Login2", "Account");
 }
示例#23
0
 public TestViewModel()
 {
     receiveModel = new ReceiveModel();
 }
        public bool InsertReceive(ReceiveModel rec, List <ReceiveDetailModel> list, List <SERIAL> serial)
        {
            string sql        = @"[sp_receiveorder_INSERT]";
            string sql_Detail = @"[sp_receiveorder_dta_INSERT]";
            string sql_Lot    = @"[sp_productlot_INSERT]";
            string sql_serial = @"[sp_serial_INSERT]";

            // update Offer status => Approve to Purchase
            // string sql_UPDATE = @"sp_orderANDoffer_UPDATE";
            string retID  = "";
            string tempID = "";

            object[] objRec = { "@EmpID", rec.EmpID, "@RecODate", rec.RecODate };
            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    retID = Db.InsertReturnID(sql, objRec);
                    if (retID != null)
                    {
                        foreach (var ls in list)
                        {
                            object[] obj     = { "@RecOID", retID, "@RecONo", ls.RecONo, "@OrdID", ls.OrdID, "@OrdNo", ls.OrdNo, "@AmountRec", ls.AmountRec };
                            object[] obj_lot = { "@LotNo", tempID, "@PrdID", ls.PrdID, "@RecOID", retID, "@RecONo", ls.RecONo, "@AmountRec", ls.AmountRec, "@Amount", ls.AmountRec, "@Price", ls.Cost, "@LotDate", System.DateTime.Now.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture) };
                            //object[] obj_stock =
                            try
                            {
                                Db.Insert(sql_Detail, obj);
                                tempID = Db.InsertReturnID(sql_Lot, obj_lot);
                            }
                            catch
                            {
                                return(false);
                            }
                        }
                        foreach (var ls in serial)
                        {
                            object[] obj_serial = { "@LotNo", tempID, "@PrdID", ls.PrdID, "@SrlID", ls.SrlID };
                            try
                            {
                                Db.Insert(sql_serial, obj_serial);
                            }
                            catch
                            {
                                return(false);
                            }
                        }
                        ts.Complete();
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch
                {
                    return(false);
                }
            }
        }
示例#25
0
        public string SaveCar(ReceiveModel car, int userid)
        {
            string saved = car.SaveCar(car, userid);

            return(saved);
        }