예제 #1
0
        public int Create(EntryCreate request)
        {
            using (var con = GetConnection())
            {
                var cmd = con.CreateCommand();
                cmd.CommandText = "Entry_Create";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@userId", request.UserId);
                cmd.Parameters.AddWithValue("@learned", request.Learned);
                cmd.Parameters.AddWithValue("@challenge", request.Challenge);
                cmd.Parameters.AddWithValue("@overcome", request.Overcome);
                cmd.Parameters.AddWithValue("@meet", request.Meet);
                cmd.Parameters.AddWithValue("@goal", request.Goal);
                cmd.Parameters.AddWithValue("@video", request.Video);
                cmd.Parameters.AddWithValue("@travel", request.Travel);
                cmd.Parameters.AddWithValue("@read", request.Read);
                cmd.Parameters.Add("@Id", SqlDbType.Int).Direction = ParameterDirection.Output;

                cmd.Parameters.AddWithValue

                cmd.ExecuteNonQuery();

                return((int)cmd.Parameters["@Id"].Value);
            }
        }
        public bool DealMessage501(bool isReceived, bool isCreated, string guid, string orderNoFake, string logisticNo, string destPath)
        {
            bool success = true;

            try
            {
                EntryCreate entry = new EntryCreate();
                entry.ItemGuid    = new Guid(guid);
                entry.IsReceived  = isReceived;
                entry.IsCreated   = isCreated;
                entry.ReceiveTime = entry.CreateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
                entry.FilePath    = destPath;
                using (var db = new EntryContext())
                {
                    var query = from m in db.MessageTracks.Include("Entry501s")
                                where m.OrderNoFake == orderNoFake
                                select m;
                    var msTrack = query.FirstOrDefault();
                    msTrack.Entry501s.Add(entry);
                    msTrack.LastUpdateTicks = DateTime.Now.Ticks;
                    msTrack.Schedule        = 501;
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Logs.Error(string.Format("DealMessage501 OrderNoFake: {0} , Exception: {1}", orderNoFake, ex.ToString()));
                success = false;
            }
            return(success);
        }
        private void CreateEntry(LocalContent local, string checkSum, string mime, int size, List <string> labels)
        {
            var ec            = new EntryCreate(checkSum, size, mime, labels, null, local.GetPathInCloud);
            var entryResponse = _entriesApi.CreateEntry(_bucketData.bucketId, ec);

            _windowElements.WriteLog($"Created entry | path {entryResponse.Path} " + $"| hash {entryResponse.ContentHash} " + $"| size {entryResponse.ContentSize} " + $"| type {entryResponse.ContentType} ");
            Upload(local);
        }
예제 #4
0
        public bool CreateEntry(EntryCreate model)
        {
            Entry newEntry = new Entry()
            {
                OwnerId = _userId, EntryDate = model.EntryDate, MoodRating = model.MoodRating, EntryContent = model.EntryContent, CreatedUtc = DateTimeOffset.UtcNow
            };

            model.CurrentUserId = _userId.ToString();
            ApplicationUser applicationUser = _db.Users.FirstOrDefault(x => x.Id == model.CurrentUserId);

            applicationUser.EntryRunningTotal += 1;
            _db.Entries.Add(newEntry);
            return(_db.SaveChanges() == 1);
        }
예제 #5
0
        public bool CreateEntry(EntryCreate model)
        {
            var entity = new Entry()
            {
                OwnerId    = _userId,
                Title      = model.Title,
                Content    = model.Content,
                CreatedUtc = DateTimeOffset.Now
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Entries.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
예제 #6
0
        public IHttpActionResult Post(EntryCreate entry)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateEntryService();

            if (!service.CreateEntry(entry))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
예제 #7
0
        public ActionResult Create(EntryCreate model)
        {
            var userId = User.Identity.GetUserId();

            model.CurrentUserId = userId;
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            else
            {
                EntryService service = CreateEntryService();
                service.CreateEntry(model);
                return(RedirectToAction("Index"));
            }
        }
예제 #8
0
        // Post - Create
        public bool CreateEntry(EntryCreate model)
        {
            var entity =
                new Entry()
            {
                Author       = _userId,
                EntryTitle   = model.EntryTitle,
                EntryContent = model.EntryContent,
                ForGoal      = model.ForGoal,
                CreatedUtc   = DateTimeOffset.Now
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Entries.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
예제 #9
0
        public ActionResult Create(EntryCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = CreateEntryService();

            if (service.CreateEntry(model))
            {
                TempData["SaveResult"] = "Your entry was sucessfully created.";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "Entry could not be created, please try again.");
            return(View(model));
        }
        public bool DealMessage301(string orderNo, string orderNoFake, string logisticsNo, bool isReceived, bool isCreated, string guid, string destPath, string logisticCode)
        {
            bool success = true;

            try
            {
                EntryCreate entry = new EntryCreate();
                entry.ItemGuid   = new Guid(guid);
                entry.IsReceived = isReceived;
                entry.IsCreated  = isCreated;
                entry.CreateTime = entry.ReceiveTime = DateTime.Now.ToString("yyyyMMddHHmmss");
                entry.FilePath   = destPath;

                MessageTrack msTrack = new MessageTrack();
                msTrack.ItemGuid        = Guid.NewGuid();
                msTrack.OrderNo         = orderNo;
                msTrack.OrderNoFake     = orderNoFake;
                msTrack.LogisticsNo     = logisticsNo;
                msTrack.Schedule        = 301;
                msTrack.LastUpdateTicks = DateTime.Now.Ticks;
                msTrack.Commnet1        = logisticCode;
                msTrack.Entry301s       = new List <EntryCreate>();
                msTrack.Entry302s       = new List <EntryReceive>();
                msTrack.Entry501s       = new List <EntryCreate>();
                msTrack.Entry502s       = new List <EntryReceive>();
                msTrack.Entry503s       = new List <EntryCreate>();
                msTrack.Entry504s       = new List <EntryReceive>();
                msTrack.Entry601s       = new List <EntryCreate>();
                msTrack.Entry602s       = new List <EntryReceive>();
                msTrack.Entry301s.Add(entry);
                using (var db = new EntryContext())
                {
                    db.MessageTracks.Add(msTrack);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Logs.Error(string.Format("DealMessage301 OrderNo: {0} , Exception: {1}", orderNo, ex.ToString()));
                success = false;
            }
            return(success);
        }
예제 #11
0
        public ActionResult Create(EntryCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = CreateEntryService();

            if (service.CreateEntry(model))
            {
                TempData["SaveResult"] = "Your entry was added to your collection.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Entry could not be created.");

            return(View(model));
        }
예제 #12
0
 public int Create(EntryCreate model)
 {
     return(entryService.Create(model));
 }