public ActionResult Add(string key, string codeLogin, string port = ":4000")
        {
            var model = new StorageFreightWarehouse();

            try
            {
                if (key != Keyapi)
                {
                    return(Json(0, JsonRequestBehavior.AllowGet));
                }
                UpdateModel(model);
                model.Note = HttpUtility.UrlDecode(model.Note);
                var dateCreated = Request["DateCreated_"];
                var date        = ConvertDate.StringToDate(dateCreated);
                model.FreightWarehouses = GetListImportItem(codeLogin, date);
                //model.DateImport = date.TotalSeconds();
                model.Status      = (int)StatusWarehouse.Pending;
                model.DateCreated = ConvertDate.TotalSeconds(DateTime.Now);
                model.Code        = DateTime.Now.ToString("yyMMddHHmm");
                model.AgencyId    = Agencyid();
                model.IsDelete    = false;
                _da.Add(model);
                _da.Save();
                var user    = _dnUserDa.GetById(model.UserID ?? new Guid());
                var jsonnew = new StorageFreightWarehouseItemNew()
                {
                    ID       = model.ID,
                    Note     = model.Note,
                    Fullname = user.LoweredUserName,
                };
                var json = new JavaScriptSerializer().Serialize(jsonnew);
                Node(port + "/addnotify/" + json);
                return(Json(model.ID, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #2
0
 public void Add(StorageFreightWarehouse item)
 {
     FDIDB.StorageFreightWarehouses.Add(item);
 }