Exemplo n.º 1
0
        public ActionResult AddAppointment(int id, int? clientid,string ismobile, FormCollection collection)
        {
            ClientActivity c = new ClientActivity { Person = UserInfo.CurUser.Id };
            db.ClientActivities.Add(c);

            TryUpdateModel(c, collection);
            if (!c.PlanTime.HasValue)
            {
                ModelState.AddModelError("PlanTime", "邀约时间不能为空");
            }
            if (ModelState.IsValid)
            {
                db.SaveChanges();
                if (!string.IsNullOrEmpty(ismobile))
                {
                    return Redirect("../View/" + c.ClientId.ToString());
                }

                return Redirect("~/Content/close.htm");
            }
            else
            {
                return View(c);
            }
        }
Exemplo n.º 2
0
        public ActionResult AddMoney(int id, FormCollection collection)
        {
            Account account = accountRes.Get(id);
            if (account == null)
            {
                ViewData["message"] = "Cannot find account";
                TempData["message"] = "Cannot find account";
                return RedirectToAction("List");
            }
            try
            {
                string moneyAdd = collection.Get("moneyAdd");
                if(account.TienNap == null)
                {
                    account.TienNap = 0;
                }
                account.TienNap += float.Parse(moneyAdd);

                accountRes.Save();
                ViewData["message"] = "Đã thêm tiền thành công";

                return View(account);
            }
            catch
            {
                return View(account);
            }
        }
Exemplo n.º 3
0
 public ActionResult Create(FormCollection collection)
 {
     var model = new Role();
     TryUpdateModel(model, collection.ToValueProvider());
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     using (var session = new SessionFactory().OpenSession())
     {
         if (session.Load<Role>(m => m.Name.Equals(model.Name)) != null)
         {
             FlashFailure("角色名称[{0}]已经存在,创建失败!", model.Name);
             return View(model);
         }
         model.CreatedAt = DateTime.Now;
         model.CreatedBy = CurrentAccountNo;
         ViewData.Model = model;
         if (session.Create(model))
         {
             FlashSuccess("角色[{0}]创建成功", model.Name);
             return Close();
         }
         FlashFailure("创建角色[{0}]失败!", model.Name);
         return View(model);
     }
 }
Exemplo n.º 4
0
        public ActionResult Create(FormCollection collection)
        {
            var item = new Item();

            try
            {
                // bind
                TryUpdateModel(item);

                // set the rest
                item.Type = _itemTypeRepository.GetById(Convert.ToInt32(collection["Type"]));
                item.CreatedDate = DateTime.Now;
                item.ModifiedDate = DateTime.Now;

                // save
                _itemRepository.Add(item);
                _itemRepository.Save();

                return RedirectToAction("Edit", new {id = item.ID});
            }
            catch
            {
                return View(item);
            }
        }
Exemplo n.º 5
0
 public ActionResult Delete(FormCollection collection, long[] ids)
 {
     if (ids.Length == 0)
     {
         FlashWarn("请选择要删除的记录。");
         return Close();
     }
     using (var session = new SessionFactory().OpenSession())
     {
         session.BeginTransaction();
         var models = session.Find<Role>(m => m.Id.In(ids));
         if (models == null || models.Count == 0)
         {
             FlashFailure("你要删除的角色不存在或者已被删除!");
             return Close();
         }
         if (models.Any((m => "SYSTEM".Equals(m.CreatedBy))))
         {
             FlashFailure("你要删除的角色包含系统内置角色,无法删除!");
             return Close();
         }
         var roleIds = models.Select(n => n.Id).ToArray();
         if (session.Delete(models) &&
             session.Delete<NavigationPriviledge>(m => m.Flag.Equals(NavigationPriviledge.RoleType) && m.OwnerId.In(roleIds)) &&
             session.Delete<AccountNavigationRef>(m => m.Type.Equals(AccountNavigationRef.RoleType) && m.OwnerId.In(roleIds)))
         {
             session.Commit();
             FlashInfo("角色删除成功");
             return Close();
         }
         session.Rollback();
         FlashError("角色删除失败!");
         return View();
     }
 }
Exemplo n.º 6
0
 public ActionResult ChangePassword(int id, FormCollection collection)
 {
     if (!UserInfo.CurUser.HasRight("业务管理-客户录入"))
     {
         return Redirect("~/content/AccessDeny.htm");
     }
     Client s = db.Clients.Find(id);
     if (s == null)
         return View("ShowError", "", "找不到客户");
     if (collection["password"] != collection["ConfirmPassword"])
     {
         ModelState.AddModelError("ConfirmPassword", "两个密码不一致");
     }
     if (collection["password"] == "")
     {
         ModelState.AddModelError("Password", "密码不能为空");
     }
     if (ModelState.IsValid)
     {
         s.Password = collection["password"];
         AccessLog.AddLog(db, UserInfo.CurUser.Name, s.Id, Client.LogClass, "变更密码", "");
         db.SaveChanges();
         return Redirect("~/content/close.htm");
     }
     return View(new Client());
 }
        public ActionResult SummaryForApprove(int id, FormCollection form)
        {
            var campaign = OperationContext.ServiceSession.EM_CampaignsService.Get(c => c.CampaignID == id).FirstOrDefault();
            if (campaign != null)
            {
                campaign.Approved = true;
                campaign.ApprovedBy = OperationContext.CurrentUser.employeeLoginName;
                campaign.ApprovedDate=DateTime.Now;
                OperationContext.ServiceSession.SaveChange();

                //invoke stored procedure, populate data to campaignInstance.
                Entities entity = new Entities();
                var emailInstanceId =
                    OperationContext.ServiceSession.EM_EmailInstancesService.Get(e => e.CampaignID == id)
                        .FirstOrDefault()
                        .EmailInstanceID;
                entity.EM_CampaignInstances_INSERT(emailInstanceId);

                return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationSuccess, "", "", null);
            }
            else
            {
                return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationFailed, "campaign is not found", "",
                    null);
            }
        }
Exemplo n.º 8
0
 public ActionResult Create(FormCollection collection)
 {
     var model = new Files();
     this.TryUpdateModel<Files>(model);
     this.ProjectService.SaveFile(model);
     return this.RefreshParent();
 }
Exemplo n.º 9
0
 public ActionResult Edit(int id, FormCollection collection)
 {
     var model = this.ProjectService.GetFile(id);
     this.TryUpdateModel<Files>(model);
     this.ProjectService.SaveFile(model);            
     return this.RefreshParent();
 }
Exemplo n.º 10
0
        public ActionResult Comment(int id, FormCollection collection)
        {
            try
            {
               // Admin.Models.Project.Project user = new Admin.Models.Project.Project();
                 Admin.Models.Project.Project proj = new Admin.Models.Project.Project();
                 Admin.Models.Project.Project com = new Admin.Models.Project.Project();
                var CommentList = new List<Admin.Models.Project.Project>();
                proj=model.GetUsernameByMemberID(Int32.Parse(Session["SelectedMemberID"].ToString()));
                var name =proj.UserName;
               // model.GetAllComments(id);
               //user=model.GetUsernameByMemberID(proj.MemberID);
               // var name=user.UserName;
                var selectedDiscussionID = Int32.Parse(Session["SelectedDiscussionID"].ToString());
                model.CreateComments(selectedDiscussionID, collection.Get("Comments"),name);
                ViewData["DiscussionID"] = id;
                Session["SelectedDiscussionID"] = id;
                com = model.GetCommentIDByDiscussionID(id);
                Session["SelectedCommentID"] = com.CommentedBy;
                return View("CommentList");

            }
            catch
            {
                return View();
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Hire Group Selection screen
 /// </summary>
 public ActionResult HireGroup(FormCollection collection)
 {
     if (collection["HireGroupDetailId"] != null)
     {
         var bookingView = new BookingViewModel
         {
             HireGroupDetailId = Convert.ToInt64(collection["HireGroupDetailId"]),
             OperationWorkPlaceId = Convert.ToInt64(collection["OperationWorkPlaceId"]),
             OperationWorkPlaceCode = Convert.ToString(collection["OperationWorkPlaceCode"]),
             StartDt = Convert.ToDateTime(collection["StartDateTime"]),
             EndDt = Convert.ToDateTime(collection["EndDateTime"]),
             TariffTypeCode = Convert.ToString(collection["TariffTypeCode"])
         };
         TempData["Booking"] = bookingView;
         return RedirectToAction("Services");
     }
     //hire group get
     var bookingViewModel = TempData["Booking"] as BookingViewModel;
     var hireGroupRequest = new GetHireGroupRequest();
     if (bookingViewModel != null)
     {
         hireGroupRequest.StartDateTime = bookingViewModel.StartDt;
         hireGroupRequest.EndDateTime = bookingViewModel.EndDt;
         hireGroupRequest.OutLocationId = bookingViewModel.OperationWorkPlaceId;
         hireGroupRequest.ReturnLocationId = bookingViewModel.OperationWorkPlaceId;
         hireGroupRequest.DomainKey = 1;
     }
     IEnumerable<HireGroupDetail> hireGroupDetails = webApiService.GetHireGroupList(hireGroupRequest)  .AvailableHireGroups.Select(x => x.CreateFrom());
     ViewBag.BookingVM = TempData["Booking"] as BookingViewModel;
     return View(hireGroupDetails.ToList());
 }
        public void EndDateTimeDateTimeUtcValueIsNullWhenNotSetByPost()
        {
            var timeZoneId = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time").StandardName;
            var startDateTimeDateTimeLocalValue = "1/20/2012 8:00 PM";
            var endDateTimeDateTimeLocalValue = string.Empty;

            var form = new FormCollection
                           {
                               {"test.StartDateTime.DateTimeLocalValue", startDateTimeDateTimeLocalValue},
                               {"test.EndDateTime.DateTimeLocalValue", endDateTimeDateTimeLocalValue},
                               {"test.TimeZoneName", timeZoneId}
                           };

            var result = BindModelByFormCollection(form);

            //StartDateTime
            Assert.AreEqual(DateTime.Parse(startDateTimeDateTimeLocalValue), result.StartDateTime.DateTimeLocalValue);
            Assert.AreEqual(DateTime.Parse(startDateTimeDateTimeLocalValue).ToUniversalTime(timeZoneId), result.StartDateTime.DateTimeUtcValue);
            Assert.AreEqual(DateTime.Parse(startDateTimeDateTimeLocalValue).ToShortDateString(), result.StartDateTime.LocalDate);
            Assert.AreEqual(DateTime.Parse(startDateTimeDateTimeLocalValue).ToShortTimeString(), result.StartDateTime.LocalTime);
            Assert.AreEqual(startDateTimeDateTimeLocalValue, result.StartDateTime.LocalDateTime);
            Assert.IsFalse(result.StartDateTime.ImplicitlySet);

            //EndDateTime
            Assert.IsNull(result.EndDateTime.DateTimeLocalValue);
            Assert.IsNull(result.EndDateTime.DateTimeUtcValue);
            Assert.AreEqual(string.Empty, result.EndDateTime.LocalDateTime);
            Assert.AreEqual(string.Empty, result.EndDateTime.LocalDate);
            Assert.AreEqual(string.Empty, result.EndDateTime.LocalTime);
            Assert.AreEqual(string.Empty, result.EndDateTime.LocalDateTimeAbreviatedMonthName);
            Assert.AreEqual(string.Empty, result.EndDateTime.LocalDateTimeDayOfMonth);
            Assert.AreEqual(string.Empty, result.EndDateTime.LocalDateTimeDayWithFullDate);
            Assert.IsFalse(result.EndDateTime.ImplicitlySet);
        }
        public void EndDateTimeDateTimeUtcValueIsSetCorrectlyFromStartDateTimeLocalDateLocalTimeValues()
        {
            var timeZoneId = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time").StandardName;
            var startDateTimeLocalDate = "01/16/2012";
            var startDateTimeLocalTime = "1:00";
            var startDateTimeDateTimeLocalValue = startDateTimeLocalDate + " " + startDateTimeLocalTime;

            var endDateTimeLocalDate = "01/16/2012";
            var endDateTimeLocalTime = "3:00";
            var endDateTimeDateTimeLocalValue = endDateTimeLocalDate + " " + endDateTimeLocalTime;

            var form = new FormCollection
                           {
                               {"test.StartDateTime.LocalDate", startDateTimeLocalDate},
                               {"test.StartDateTime.LocalTime", startDateTimeLocalTime},
                               {"test.EndDateTime.LocalTime", endDateTimeLocalTime},
                               {"test.TimeZoneName", timeZoneId}
                           };
            var result = BindModelByFormCollection(form);

            Assert.AreEqual(DateTime.Parse(startDateTimeDateTimeLocalValue), result.StartDateTime.DateTimeLocalValue);
            Assert.AreEqual(DateTime.Parse(startDateTimeDateTimeLocalValue).ToUniversalTime(timeZoneId), result.StartDateTime.DateTimeUtcValue);

            Assert.AreEqual(DateTime.Parse(endDateTimeDateTimeLocalValue), result.EndDateTime.DateTimeLocalValue);
            Assert.AreEqual(DateTime.Parse(endDateTimeDateTimeLocalValue).ToUniversalTime(timeZoneId), result.EndDateTime.DateTimeUtcValue);
        }
Exemplo n.º 14
0
        public ActionResult AddressAndPayment(FormCollection values)
        {
            var order = new Order();
            TryUpdateModel(order);

            try
            {
                if (string.Equals(values["PromoCode"], PromoCode,
                    StringComparison.OrdinalIgnoreCase) == false)
                {
                    return View(order);
                }
                else
                {

                    order.OrderDate = DateTime.Now;

                    //Save Order
                    storeDB.Orders.Add(order);
                    storeDB.SaveChanges();
                    //Process the order
                    var cart = ShoppingCart.GetCart(this.HttpContext);
                    cart.CreateOrder(order);

                    return RedirectToAction("Complete",
                        new { id = order.OrderId });
                }
            }
            catch
            {
                //Invalid - redisplay with errors
                return View(order);
            }
        }
Exemplo n.º 15
0
 public ActionResult AjaxAddComment(FormCollection Fm)
 {
     Maticsoft.BLL.SNS.Comments comments = new Maticsoft.BLL.SNS.Comments();
     Maticsoft.Model.SNS.Comments comModel = new Maticsoft.Model.SNS.Comments();
     int num = Globals.SafeInt(Fm["TargetId"], 0);
     int num2 = 3;
     int num3 = 0;
     string source = ViewModelBase.ReplaceFace(Fm["Des"]);
     comModel.CreatedDate = DateTime.Now;
     comModel.CreatedNickName = base.currentUser.NickName;
     comModel.CreatedUserID = base.currentUser.UserID;
     comModel.Description = source;
     comModel.HasReferUser = source.Contains<char>('@');
     comModel.IsRead = false;
     comModel.ReplyCount = 0;
     comModel.TargetId = num;
     comModel.Type = num2;
     comModel.UserIP = base.Request.UserHostAddress;
     num3 = comments.AddEx(comModel);
     if (num3 > 0)
     {
         comModel.CommentID = num3;
         comModel.Description = ViewModelBase.RegexNickName(comModel.Description);
         List<Maticsoft.Model.SNS.Comments> model = new List<Maticsoft.Model.SNS.Comments> {
             comModel
         };
         return this.PartialView("CommentList", model);
     }
     return base.Content("No");
 }
Exemplo n.º 16
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var picture = new Gallery();
                // TODO: Add insert logic here
                var info = new StringBuilder();
                foreach (string file in Request.Files)
                {
                    HttpPostedFileBase postedFile = Request.Files[file];
                    if (postedFile.ContentLength == 0)
                        continue;
                    var newFileName = Guid.NewGuid() + "-" + postedFile.FileName;
                    string newFilePath = Path.Combine(
                        AppDomain.CurrentDomain.BaseDirectory + @"Content\Gallery\",
                        Path.GetFileName( newFileName )
                    );
                    postedFile.SaveAs( newFilePath );

                    picture.name = Request.Form["name"];
                    picture.filename = newFileName;
                    picture.upload_by = galleryRepository.GetAuthorId( User.Identity.Name );
                    picture.upload_date = DateTime.UtcNow;
                    galleryRepository.Add( picture );
                    galleryRepository.Save();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View( "Error" );
            }
        }
Exemplo n.º 17
0
        public ActionResult Create(CompanyAdvice companyAdvice, FormCollection form)
        {
            if (companyAdvice.CompanysId == null)
            {
                ModelState.AddModelError("CompanysId", "Please choose a company.");
            }
            ValidateAdvice(companyAdvice);

            if (ModelState.IsValid)
            {
                try
                {
                    _adviceApplicationService.AddCompanyAdvice(CurrentMentor, companyAdvice);

                    return RedirectToAction("Index", "Advice");
                }
                catch
                {
                    return RedirectToAction("Create");
                }
            }

            var companies = _companyApplicationService.GetAllCompanies();
            ViewData["Companies"] = new SelectList(companies, "Id", "CompanyName", companyAdvice.CompanysId);
            ViewData["Semaphores"] = _semaphoreApplicationService.GetAllSemaphores();
            SetAdviceTagViewData();
            return View(companyAdvice);
        }
        public ActionResult DeleteInboxPM(FormCollection formCollection)
        {
            foreach (var key in formCollection.AllKeys)
            {
                var value = formCollection[key];

                if (value.Equals("on") && key.StartsWith("pm", StringComparison.InvariantCultureIgnoreCase))
                {
                    var id = key.Replace("pm", "").Trim();
                    int privateMessageId = 0;

                    if (Int32.TryParse(id, out privateMessageId))
                    {
                        var pm = _forumService.GetPrivateMessageById(privateMessageId);
                        if (pm != null)
                        {
                            if (pm.ToCustomerId == _workContext.CurrentCustomer.Id)
                            {
                                pm.IsDeletedByRecipient = true;
                                _forumService.UpdatePrivateMessage(pm);
                            }
                        }
                    }
                }
            }
            return RedirectToRoute("PrivateMessages");
        }
        public ActionResult Create(ProductAttributeValue model, FormCollection form)
        {

            int tagId = int.Parse(form["tag"]);
            var tag = _repository.GetProductAttributeValueTag(tagId);

            _repository.LangId = CurrentLangId;
            var productAttributeValue = new ProductAttributeValue()
            {
                CurrentLang = model.CurrentLang,
                ProductAttributeId = model.ProductAttributeId,
                Title = model.Title,
                ProductAttributeValueTag = tag
            };
            try
            {
                _repository.AddProductAttributeValue(productAttributeValue);
                Cache.Default.Clear();
            }
            catch (Exception ex)
            {
                TempData["errorMessage"] = ex.Message;
            }
            return RedirectToAction("Index", new { id = productAttributeValue.ProductAttributeId });
        }
Exemplo n.º 20
0
        public ActionResult Index(FormCollection result)
        {
            int flag = 0;
            int i = 1;

            foreach (var key in result.Keys)
            {
                if (key.ToString().StartsWith("RName"))
                {
                    string RName = !string.IsNullOrEmpty(result["RName" + i]) ? result["RName" + i].Trim() : "";
                    if (RName != "")
                    {
                        string RBrief = !string.IsNullOrEmpty(result["RBrief" + i]) ? result["RBrief" + i].Trim() : "";
                        if (RBrief != "")
                        {
                            flag = 1;
                        }
                    }

                    i++;
                }
            }

            if (flag == 1)
                ViewData["OnSuccess"] = "Records Inserted Succesfully";

            return View();
        }
Exemplo n.º 21
0
        public ActionResult Change(MatchesTeam mt, FormCollection form)
        {
            MatchesTeam teamLocal = new MatchesTeam() { matchId = int.Parse(form["matchId"].ToString()), teamId = int.Parse(form["dropHome"].ToString()), teamIsLocal = true };
            MatchesTeam teamAway = new MatchesTeam() { matchId = int.Parse(form["matchId"].ToString()), teamId = int.Parse(form["dropAway"].ToString()), teamIsLocal = false };

            Context ctx = new Context();

            int matchId = int.Parse(form["matchId"].ToString());

            var exists = (from ma in ctx.MatchesTeam
                          where ma.matchId == matchId
                          select ma).ToList();

            if (exists.Count == 0)
            {
                ctx.MatchesTeam.Add(teamLocal);
                ctx.MatchesTeam.Add(teamAway);
            }
            else
            {
                if (exists[0].teamIsLocal == true)
                {
                    exists[0].teamId = int.Parse(form["dropHome"].ToString());
                    exists[1].teamId = int.Parse(form["dropAway"].ToString());
                }
                else
                {
                    exists[1].teamId = int.Parse(form["dropHome"].ToString());
                    exists[0].teamId = int.Parse(form["dropAway"].ToString());
                }

            }
            ctx.SaveChanges();
            return RedirectToAction("List", "Match");
        }
Exemplo n.º 22
0
        public ContentResult Save(FormCollection form)
        {
            var dataAction = DhtmlxRequest.ParseEventRequest(form);
            try
            {
                switch (dataAction.Action)
                {
                    case DhtmlxAction.Inserted:
                        // add new gantt task entity
                        _eventService.InsertEvent(dataAction.UpdatedEvent);
                        break;
                    case DhtmlxAction.Deleted:
                        // remove gantt tasks
                        _eventService.DeleteEvent(_eventService.GetEvent(dataAction.SourceId));
                        break;
                    case DhtmlxAction.Updated:
                        // update gantt task
                        _eventService.UpdateEvent(dataAction.UpdatedEvent);
                        //db.Entry(db.Tasks.Find(ganttData.UpdatedTask.Id)).CurrentValues.SetValues(ganttData.UpdatedTask);
                        break;
                    default:
                        dataAction.Action = DhtmlxAction.Error;
                        break;
                }
            }
            catch
            {
                // return error to client if something went wrong
                dataAction.Action = DhtmlxAction.Error; ;
            }

            return EventRespose(dataAction);
        }
Exemplo n.º 23
0
        public ActionResult Create(string entityName, FormCollection collection)
        {
            var entity = Admin.GetEntity(entityName);
            if (entity == null)
            {
                return RedirectToAction("NotFound", new { entityName });
            }

            try
            {
                var savedId = _entityService.Create(entity, collection, Request.Files);
                if (savedId != null)
                {
                    _notificator.Success(IlaroAdminResources.AddSuccess, entity.Verbose.Singular);

                    return SaveOrUpdateSucceed(entityName, savedId);
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                _notificator.Error(ex.Message);
            }

            var model = new EntityCreateOrEditModel
            {
                Entity = entity,
                PropertiesGroups = _entityService.PrepareGroups(entity)
            };

            return View(model);
        }
Exemplo n.º 24
0
        public ActionResult Create(FormCollection formCollection)
        {
            try {
                Order order = new Order();
                order.ClientID = WebSecurity.CurrentUserId;
                order.Date = DateTime.Now;
                order.ConditionID = db.Conditions.Where(condition => condition.Name.Equals("Оформлен")).FirstOrDefault().ID;
                order.Address = formCollection["address"];
                db.Orders.Add(order);
                db.SaveChanges();
                Cart cart = (Cart)Session["Cart"];
                List<OrderItem> orderItems = new List<OrderItem>();
                foreach (var item in cart.Content) {
                    OrderItem orderItem = new OrderItem();
                    orderItem.BookID = item.Key;
                    orderItem.Count = item.Value;
                    orderItem.OrderID = order.ID;
                    orderItems.Add(orderItem);
                }
                order.OrderItems = orderItems;
                db.Entry(order).State = EntityState.Modified;
                db.SaveChanges();
                ((Cart)Session["Cart"]).Clear();
            } catch {

            }
            return RedirectToAction("Index");
        }
Exemplo n.º 25
0
        public ActionResult Edit(FormCollection collection)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return RedirectToAction("Index");
            }

            try
            {
                Article_section sec = db.CreateObject<Article_section>();

                sec.Article_id = Int32.Parse(collection["Article_id"]);
                sec.User_name = User.Identity.Name;
                sec.Section_heading = collection["Section_heading"];
                sec.Section_text = collection["Section_text"];
                sec.Pub_date = DateTime.Now;
                sec.delete_flag = 0;
                sec.Parent_section = Int32.Parse(collection["Parent_section"]);
                sec.Section_order = Int32.Parse(collection["Section_order"]);

                db.SaveChanges();
                return RedirectToAction("Wiki/Details/" + sec.Article.Title);

            }
            catch
            {
                return View();
            }
        }
Exemplo n.º 26
0
        public ActionResult Create(FormCollection form, int? parentId)
        {
            var building = new Building
                             {
                                 Name = Utils.Transliterator.Transliterate(form["Name"])
                             };
            TryUpdateModel(building, new[] { "Title", "SortOrder", "SeoDescription", "SeoKeywords", "ContentType" });
            building.CategoryLevel = 1;
            building.Active = true;
            building.Text = HttpUtility.HtmlDecode(form["Text"]);

            if (parentId.HasValue)
            {
                var parent = _context.Building.First(c => c.Id == parentId);
                parent.Children.Add(building);
            }
            else
            {
                _context.AddToBuilding(building);
            }
            _context.SaveChanges();


            switch (form["ContentType"])
            {
                case "1": return RedirectToAction("Buildings", "Home", new { area = "" });
                case "2": return RedirectToAction("Products", "Home", new { area = "" });
                case "3": return RedirectToAction("Documents", "Home", new { area = "" });
                case "4": return RedirectToAction("WhereToBuy", "Home", new { area = "" });
                case "5": return RedirectToAction("About", "Home", new { area = "" });
            }
            return RedirectToAction("Buildings", "Home", new { area = "" });
        }
Exemplo n.º 27
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var courseToSubmit = new Course
                {
                    CreatedByUsername = User.Identity.Name,
                    LastUpdateByUsername = User.Identity.Name,
                    CreationDate = DateTime.Now,
                    Description = collection["description"],
                    Name = collection["name"],
                    LastUpdated = DateTime.Now,
                    State = CourseState.Active,
                    NumberOfCourseCompletions = 0
                };

                CoursesModel cm = new CoursesModel();
                var savedCourse = cm.AddOrUpdateCourse(courseToSubmit);

                return RedirectToAction("Create", "CourseContents", new { id = savedCourse.Id });
            }
            catch
            {
                return View();
            }
        }
Exemplo n.º 28
0
        public void AddUser(FormCollection collection, User user)
        {
            UserBLL ub = new UserBLL();
             String message=ub.AddNewUser(collection,user);

             Index();
        }
 public ActionResult Index(FormCollection collection)
 {
     if (!AttendeeRegistrationIsOpen())
     {
         return View("RegistrationClosed");
     }
     var newAttendee = new Attendee();
     // This will try to update all the fields in the model based on the form collection
     if (TryUpdateModel(newAttendee, "Attendee", collection))
     {
         _repository.AddAttendee(newAttendee);
         _repository.Save();
         SettingsData settings = SettingsData.Default;
         //TODO: localize string replacement
         var message = new MailMessage(settings.EmailFrom,
                                       newAttendee.People.email,
                                       settings.RegistrationSubject,
                                       settings.RegistrationMessage.Replace(
                                         "{name}", newAttendee.People.name).Replace(
                                             "{role}", "Attendee"));
         try
         {
             Mailer.Send(message);
         }
         catch
         {
             //TODO: log this
         }
         return RedirectToAction("Success");
     }
     // TODO: make validation messages show
     // this isn't showing error messages; eventually that should be investigated
     AttendeeEditData data = MakeEditDateFromAttendee(newAttendee);
     return RedirectToAction("Index", data);
 }
        public async Task AddNewPinscherdogComing(int userId, FormCollection collection)
        {
            var camel = new BreedingComings
            {
                User = _usersRepository.Get().FirstOrDefault(i => i.Id == userId),
                BreedingType = _breedingTypeRepository.Get().FirstOrDefault(i => i.Name == "Pinscherdog"),
                ReceiptDate = DateTime.Parse(collection[1]),
                CultureType = collection[2],
                Name = collection[3],
                MassType = collection[4],
                Mass = Convert.ToDecimal(collection[5].Replace(".", ",")),
                CurrencyType = collection[6],
                Cost = Convert.ToDecimal(collection[7].Replace(".", ",")),
                Amount = Convert.ToInt32(collection[8]),
                Document = FileNameValidator(collection[9])
            };

            _breedingComingsRepository.Add(camel);
            var culturetype = collection[2];
            var name = collection[3];
            var firstOrDefault = _breedingComingsRepository.Get().FirstOrDefault(c => c.CultureType == culturetype && c.Name == name);
            if (firstOrDefault != null)
            {
                var profit = new BreedingProfits
                {
                    Id = firstOrDefault.Id,
                    CultureType = collection[2],
                    Name = collection[3],
                    User = _usersRepository.Get().FirstOrDefault(i => i.Id == userId),
                    BreedingType = _breedingTypeRepository.Get().FirstOrDefault(i => i.Name == "Pinscherdog")
                };
                await _breedingProfitRepository.AddAsync(profit);
            }
        }
Exemplo n.º 31
0
        public async Task <ActionResult> BuySell(System.Web.Mvc.FormCollection collection)
        {
            if (preventResend != 1)
            {
                try
                {
                    int      sid    = (int)Session["userID"];
                    CertUser result = (from r in db.CertUsers
                                       where r.certUserID == sid
                                       select r).SingleOrDefault();
                    result.sellAmount = 0;
                    result.buyAmount  = 0;
                    result.bdokenPass = "";


                    string clickedButton = collection["hiddenClickedButton"];
                    result.bdokenPass = collection["passphrase"];
                    if (result.bdokenPass == "")
                    {
                        return(RedirectToAction("Index", new { mssg = 4 }));
                    }
                    if (!Decimal.TryParse(collection["hiddenAmount"], out decimal amount))
                    {
                        return(RedirectToAction("Index", new { mssg = 7 }));
                    }

                    if (clickedButton.Equals("Buy"))
                    {
                        result.buyAmount = amount;
                        if (result.buyAmount != 0)
                        {
                            try
                            {
                                await BDC.Buy(result.beternumAddress, result.bdokenPass, (BigInteger)result.buyAmount * 1000000000000000000);
                            }
                            catch
                            {
                                return(RedirectToAction("Index", new { mssg = 5 }));
                            }
                        }
                        else
                        {
                            return(RedirectToAction("Index", new { mssg = 6 }));
                        }
                    }
                    else if (clickedButton.Equals("Sell"))
                    {
                        result.sellAmount = amount;
                        if (result.sellAmount != 0)
                        {
                            try
                            {
                                await BDC.Sell(result.beternumAddress, result.bdokenPass, (BigInteger)(result.sellAmount * 1000000000000000000));
                            }
                            catch
                            {
                                return(RedirectToAction("Index", new { mssg = 5 }));
                            }
                        }
                        else
                        {
                            return(RedirectToAction("Index", new { mssg = 6 }));
                        }
                    }
                    else if (clickedButton.Equals("Donate"))
                    {
                        result.donateAmount = amount;
                        if (result.donateAmount != 0)
                        {
                            try
                            {
                                await BDC.BloodForTheBloodGod(result.beternumAddress, result.bdokenPass, (BigInteger)(result.donateAmount * 1000000000000000000));
                            }
                            catch
                            {
                                return(RedirectToAction("Index", new { mssg = 5 }));
                            }
                        }
                        else
                        {
                            return(RedirectToAction("Index", new { mssg = 6 }));
                        }
                    }

                    preventResend     = 1;
                    result.sellAmount = 0;
                    result.buyAmount  = 0;
                    BigInteger sellPrice = await BDC.GetSellPrice(result.beternumAddress);

                    BigInteger buyPrice = await BDC.GetBuyPrice(result.beternumAddress);

                    result.sellPrice = 1 / (decimal)sellPrice;
                    result.buyPrice  = (decimal)buyPrice / 1000000000000000000;
                    await CheckBDokenBalance();

                    return(View("Index", result));
                }
                catch
                {
                    return(Redirect("~/Login/Index"));
                }
            }
            else
            {
                int      sid    = (int)Session["userID"];
                CertUser result = (from r in db.CertUsers
                                   where r.certUserID == sid
                                   select r).SingleOrDefault();
                result.bdokenPass = "";
                result.sellAmount = 0;
                result.buyAmount  = 0;
                preventResend     = 0;
                BigInteger sellPrice = await BDC.GetSellPrice(result.beternumAddress);

                BigInteger buyPrice = await BDC.GetBuyPrice(result.beternumAddress);

                result.sellPrice = 1 / (decimal)sellPrice;
                result.buyPrice  = (decimal)buyPrice / 1000000000000000000;
                await CheckBDokenBalance();

                return(View("Index", result));
            }
        }
Exemplo n.º 32
0
        public override System.Web.Mvc.ActionResult EditBlogEntry(System.Guid?id, MVCBlog.Core.Entities.BlogEntry blogEntry, System.Web.Mvc.FormCollection formValues)
        {
            var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.EditBlogEntry);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "blogEntry", blogEntry);
            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "formValues", formValues);
            EditBlogEntryOverride(callInfo, id, blogEntry, formValues);
            return(callInfo);
        }
Exemplo n.º 33
0
 partial void EditBlogEntryOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Guid?id, MVCBlog.Core.Entities.BlogEntry blogEntry, System.Web.Mvc.FormCollection formValues);
 partial void DeleteOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, System.Web.Mvc.FormCollection collection);
Exemplo n.º 35
0
        public override System.Web.Mvc.ActionResult RegisterUser(Core.Profiles.Models.RegistrationWidgetViewModel model, System.Web.Mvc.FormCollection collection)
        {
            var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.RegisterUser);

            callInfo.RouteValueDictionary.Add("model", model);
            callInfo.RouteValueDictionary.Add("collection", collection);
            return(callInfo);
        }
Exemplo n.º 36
0
 partial void IndexOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Web.Mvc.FormCollection formCollection);
Exemplo n.º 37
0
        public void FileController_CreateDocumentFromTemplateJSON_Canada_Test()
        {
            foreach (CultureInfo culture in setupData.cultureListGood)
            {
                controllerAction = "CreateDocumentFromTemplateJSON";
                contactModel     = contactModelListGood[0];

                SetupTest(contactModel, culture, controllerAction);

                using (TransactionScope ts = new TransactionScope())
                {
                    TVItemModel tvItemModelRoot = tvItemService.GetRootTVItemModelDB();
                    Assert.AreEqual("", tvItemModelRoot.Error);

                    TVItemModel tvItemModelCanada = tvItemService.GetChildTVItemModelWithTVItemIDAndTVTextStartWithAndTVTypeDB(tvItemModelRoot.TVItemID, "Canada", TVTypeEnum.Country);
                    Assert.AreEqual("", tvItemModelRoot.Error);

                    DirectoryInfo di = new DirectoryInfo(tvFileService.GetServerFilePath(tvItemModelRoot.TVItemID));

                    if (!di.Exists)
                    {
                        di.Create();
                    }

                    di = new DirectoryInfo(tvFileService.GetServerFilePath(tvItemModelRoot.TVItemID));
                    Assert.IsTrue(di.Exists);

                    FileInfo fi = new FileInfo(tvFileService.GetServerFilePath(tvItemModelRoot.TVItemID) + "this_should_be_unique.docx");

                    if (!fi.Exists)
                    {
                        StreamWriter sw = new StreamWriter(fi.FullName);
                        sw.WriteLine("|||Testing document|||");
                        sw.Close();
                    }

                    string FileName = "this_should_be_unique.docx";
                    fi = new FileInfo(tvFileService.GetServerFilePath(tvItemModelRoot.TVItemID) + FileName);
                    Assert.IsTrue(fi.Exists);

                    TVItemModel tvItemModelFile = tvItemService.PostAddChildTVItemDB(tvItemModelRoot.TVItemID, FileName, TVTypeEnum.File);
                    Assert.AreEqual("", tvItemModelFile.Error);

                    TVFileModel tvFileModelNew = new TVFileModel();
                    tvFileModelNew.TVFileTVItemID = tvItemModelFile.TVItemID;

                    FillTVFileModel(tvFileModelNew);
                    tvFileModelNew.Language            = controller.LanguageRequest;
                    tvFileModelNew.FilePurpose         = FilePurposeEnum.Template;
                    tvFileModelNew.FileType            = FileTypeEnum.DOCX;
                    tvFileModelNew.FileDescription     = randomService.RandomString("File Description", 200);
                    tvFileModelNew.FileSize_kb         = (int)(fi.Length / 1024);
                    tvFileModelNew.FileInfo            = randomService.RandomString("File Info", 200);
                    tvFileModelNew.FileCreatedDate_UTC = DateTime.Now;
                    tvFileModelNew.ClientFilePath      = "";
                    tvFileModelNew.ServerFileName      = FileName;
                    tvFileModelNew.ServerFilePath      = tvFileService.ChoseEDriveOrCDrive(tvFileService.GetServerFilePath(tvItemModelRoot.TVItemID));

                    TVFileModel tvFileModelRet = tvFileService.PostAddTVFileDB(tvFileModelNew);
                    Assert.AreEqual("", tvFileModelRet.Error);

                    DocTemplateModel docTemplateModelNew = new DocTemplateModel()
                    {
                        TVType         = tvItemModelCanada.TVType,
                        TVFileTVItemID = tvFileModelRet.TVFileTVItemID,
                        FileName       = FileName,
                    };

                    DocTemplateModel docTemplateModelRet = docTemplateService.PostAddDocTemplateDB(docTemplateModelNew);
                    Assert.AreEqual("", docTemplateModelRet.Error);

                    System.Web.Mvc.FormCollection fc = new System.Web.Mvc.FormCollection();
                    fc.Add("TVItemID", tvItemModelCanada.TVItemID.ToString());
                    fc.Add("DocTemplateID", docTemplateModelRet.DocTemplateID.ToString());

                    JsonResult jsonResult = controller.CreateDocumentFromTemplateJSON(fc) as JsonResult;
                    Assert.IsNotNull(jsonResult);
                    string retStr = (string)jsonResult.Data;
                    Assert.AreEqual("", retStr);

                    AppTaskModel appTaskModel = appTaskService.GetAppTaskModelWithTVItemIDTVItemID2AndCommandDB(tvItemModelCanada.TVItemID, tvItemModelCanada.TVItemID, AppTaskCommandEnum.CreateDocumentFromTemplate);
                    Assert.AreEqual("", appTaskModel.Error);
                    Assert.AreEqual("", appTaskModel.Error);
                }
            }
        }
Exemplo n.º 38
0
        public override System.Web.Mvc.ActionResult Index(int?currentPageNum, int?pageSize, System.Web.Mvc.FormCollection collection)
        {
            if (!currentPageNum.HasValue)
            {
                currentPageNum = 1;
            }
            if (!pageSize.HasValue)
            {
                pageSize = PagedListViewModel <SchoolInfoPageListViewModel> .DefaultPageSize;
            }

            var list = RF.Concrete <IUnitInfoRepository>().GetSchoolInfoList();
            var contactLitViewModel = new PagedListViewModel <SchoolInfoPageListViewModel>(currentPageNum.Value, pageSize.Value, list);

            return(View(contactLitViewModel));
        }
Exemplo n.º 39
0
 partial void SortListOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int?page, System.Web.Mvc.FormCollection collection);
        public override System.Web.Mvc.ActionResult Index(int?currentPageNum, int?pageSize, System.Web.Mvc.FormCollection collection)
        {
            if (!currentPageNum.HasValue)
            {
                currentPageNum = 1;
            }
            if (!pageSize.HasValue)
            {
                pageSize = PagedResult <Department> .DefaultPageSize;
            }
            int pageNum = currentPageNum.Value;


            int deptype = 1;

            var villagelist = repo.FindAll(new DepartmentTypeSpecifications((DepartmentType)deptype)).ToList();

            var contactLitViewModel = new DepartmentPagedListViewModel(pageNum, pageSize.Value, villagelist.ToList());

            contactLitViewModel.DepartmentType = (DepartmentType)deptype;
            return(View(contactLitViewModel));
        }
Exemplo n.º 41
0
 partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, DB.Entities.Location entity, System.Web.Mvc.FormCollection collection, string editViewName);
Exemplo n.º 42
0
        public override System.Web.Mvc.ActionResult Index(int?currentPageNum, int?pageSize, System.Web.Mvc.FormCollection collection)
        {
            if (!currentPageNum.HasValue)
            {
                currentPageNum = 1;
            }
            if (!pageSize.HasValue)
            {
                pageSize = PagedListViewModel <Dictionary> .DefaultPageSize;
            }
            int pageNum = currentPageNum.Value;

            Guid guid = Guid.Parse(LRequest.GetString("dicTypeId"));

            var list = repo.GetDictTypeList(guid);

            var contactLitViewModel = new DictionaryPagedListViewModel(pageNum, pageSize.Value, list.ToList());

            contactLitViewModel.DicTypeId = guid;

            return(View(contactLitViewModel));
        }
Exemplo n.º 43
0
        public ActionResult FF(HttpPostedFileBase file, System.Web.Mvc.FormCollection form1, FFAC model)
        {
            var MDclient              = new MongoClient("mongodb+srv://fred:" + MongoDBPW() + "@freefinancial-tubyw.azure.mongodb.net/QuickPoint?retryWrites=true&w=majority");
            var db                    = MDclient.GetDatabase("QuickPoint");
            var collec                = db.GetCollection <BsonDocument>("FreeFinancial");
            var dt                    = DateTime.Now.ToString();
            var username              = escapeCharacters((form1["name"].ToString()));
            var email                 = escapeCharacters((form1["email"].ToString()));
            var phone                 = escapeCharacters((form1["phone"].ToString()));
            var staffno               = escapeCharacters((form1["staffno"].ToString()));
            var turnover              = escapeCharacters((form1["turnover"].ToString()));
            var selected              = model.Business;
            var bookkeeping           = model.Bookkeeping;
            var payroll               = model.Payroll;
            var CompaniesHouseReturns = model.CompaniesHouseReturns;
            var SelfAssessment        = model.SelfAssessment;
            var VATReturns            = model.VATReturns;
            var AccountsManagement    = model.AccountsManagement;
            var BusinessConsultation  = model.BusinessConsultation;
            var TaxationAdvice        = model.TaxationAdvice;

            try
            {
                byte[] data;
                using (Stream inputStream = file.InputStream)
                    using (MemoryStream ms = new MemoryStream())
                        using (var client = new SmtpClient("smtp.office365.com", 587))
                            using (var message = new MailMessage(Utils.GetConfigSetting("Fredemail"), Utils.GetConfigSetting("LudaEmail")))
                            {
                                if (file != null)
                                {
                                    MemoryStream memoryStream = inputStream as MemoryStream;
                                    if (memoryStream == null)
                                    {
                                        memoryStream = new MemoryStream();
                                        inputStream.CopyTo(memoryStream);
                                    }
                                    data = memoryStream.ToArray();
                                    memoryStream.Position = 0;
                                    message.Attachments.Add(new Attachment(memoryStream, file.FileName, file.ContentType));
                                }

                                System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType(System.Net.Mime.MediaTypeNames.Application.Octet);
                                message.Subject = "New Financial Request from " + username;
                                message.Body    = "Name:" + "\n" + username + "\n" + "\n" + "Time" + "\n" + dt + "\n" + "\n" + "Email:" + "\n" + email + "\n" + "\n" + "Phone:" + "\n" + phone + "\n" + "\n" + "Business Type:" + "\n" + "\n" + selected + "\n" + "\n" + "Turnover:" + "\n" + "\n" + turnover + "\n" + "\n" + "Number of Staff:" + "\n" + staffno + "\n" + "\n" + "Required Services:" + "\n" + "\n" + "Bookkeeping: " + bookkeeping
                                                  + "\n" + "Payroll: " + payroll + "\n" + "Companies House Returns: " + CompaniesHouseReturns + "\n" + "Self Assessment: " + SelfAssessment + "\n" +
                                                  "VAT Returns: " + VATReturns + "\n" + "Accounts Management: " + AccountsManagement + "\n" + "Business Consultation: " + BusinessConsultation + "\n" + "Taxation Advice: " + TaxationAdvice + "\n";


                                message.IsBodyHtml = false;

                                client.Credentials = new NetworkCredential(Utils.GetConfigSetting("Fredemail"), Utils.GetConfigSetting("fpw"));

                                // message.CC.Add(Utils.GetConfigSetting("Fredemail"));
                                // message.CC.Add(Utils.GetConfigSetting("Andrewemail"));
                                client.EnableSsl = true;
                                client.Send(message);

                                var document = new BsonDocument
                                {
                                    { "Name", (form1["name"].ToString()) },
                                    { "Email", (form1["email"].ToString()) },
                                    { "Phone", (form1["phone"].ToString()) },
                                    { "Staff Number", (form1["staffno"].ToString()) },
                                    { "Turnover", (form1["turnover"].ToString()) },
                                    { "Date", dt },
                                };

                                collec.InsertOneAsync(document);
                            }
                ViewBag.Message = "Email sent";
                return(View());
            }
            catch (Exception ex)
            {
                ViewBag.Message = "Email not sent" + "\n" + ex;
                return(View());
            }
        }
Exemplo n.º 44
0
        public override System.Web.Mvc.ActionResult Edit(DB.Entities.Location entity, System.Web.Mvc.FormCollection collection, string editViewName)
        {
            var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "entity", entity);
            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "collection", collection);
            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "editViewName", editViewName);
            EditOverride(callInfo, entity, collection, editViewName);
            return(callInfo);
        }
        public JsonResult AddTimesheet(System.Web.Mvc.FormCollection formCollection)
        {
            List <object> obj = new List <object>();
            List <TIM_DocumentLibraryModel>   DeleteDocument     = new List <TIM_DocumentLibraryModel>();
            List <TIM_EmployeeTimesheetModel> DeleteEmpTimesheet = new List <TIM_EmployeeTimesheetModel>();

            var Timesheet = formCollection["TimesheetDetails"];
            List <TIM_EmployeeTimesheetModel> EmpTimesheet = JsonConvert.DeserializeObject <List <TIM_EmployeeTimesheetModel> >(Timesheet);

            var DeleteTimesheet = formCollection["DeleteTimesheet"];

            if (DeleteTimesheet != null)
            {
                DeleteEmpTimesheet = JsonConvert.DeserializeObject <List <TIM_EmployeeTimesheetModel> >(DeleteTimesheet);
            }

            var deletedoc = formCollection["DeleteDocument"];

            if (deletedoc != null)
            {
                DeleteDocument = JsonConvert.DeserializeObject <List <TIM_DocumentLibraryModel> >(deletedoc);
            }

            int    i = 0;
            string InternalStatus = "Inprogress";
            var    spContext      = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

            try
            {
                using (var clientContext = spContext.CreateUserClientContextForSPHost())
                {
                    List <TIM_StatusMasterModel> lstPendingStatus = new List <TIM_StatusMasterModel>();
                    lstPendingStatus = BalStatus.GetPendingStatus(clientContext);
                    List <GEN_ApproverRoleNameModel> lstApprover = BalApprover.getApproverData(clientContext, BalEmp.GetEmpCodeByLogIn(clientContext), "Timesheet", "Main");
                    Emp_BasicInfoModel Employee = BalEmp.GetEmpMailByLogIn(clientContext);

                    if (DeleteDocument.Count > 0)
                    {
                        int z = 0;
                        foreach (var deleteItem in DeleteDocument)
                        {
                            string Result = BalDocument.DeleteDocument(clientContext, deleteItem.ID.ToString());
                            if (Result == "Delete")
                            {
                                z++;
                            }
                        }
                        if (z != DeleteDocument.Count)
                        {
                            obj.Add("ERROR");
                            return(Json(obj, JsonRequestBehavior.AllowGet));
                        }
                    }

                    if (DeleteEmpTimesheet.Count > 0)
                    {
                        int z = 0;
                        List <TIM_WorkFlowMasterModel> lstTimesheetDeletion = new List <TIM_WorkFlowMasterModel>();
                        lstTimesheetDeletion = BalWorkflow.GetTimesheetDeletion(clientContext);
                        var DeleteItem = "'StatusId': '" + lstTimesheetDeletion[0].ToStatusID + "'";
                        DeleteItem += " ,'InternalStatus': '" + lstTimesheetDeletion[0].InternalStatus + "'";
                        foreach (var deleteEmpItem in DeleteEmpTimesheet)
                        {
                            string Result = BalEmpTimesheet.UpdateTimesheet(clientContext, DeleteItem, deleteEmpItem.ID.ToString());
                            if (Result == "Update")
                            {
                                var hours    = deleteEmpItem.Hours.Split(':');
                                var h        = Convert.ToInt32(hours[0]) * (-1);
                                var m        = Convert.ToInt32(hours[1]) * (-1);
                                var NewHours = h.ToString() + ":" + m.ToString();
                                deleteEmpItem.AlterUtilizeHour = NewHours;
                                string status = GetAndEditPrevTimesheet(clientContext, deleteEmpItem);
                                if (status != "OK")
                                {
                                    obj.Add("ERROR");
                                    return(Json(obj, JsonRequestBehavior.AllowGet));
                                }
                                else
                                {
                                    z++;
                                }
                            }
                        }
                        if (z != DeleteEmpTimesheet.Count)
                        {
                            obj.Add("ERROR");
                            return(Json(obj, JsonRequestBehavior.AllowGet));
                        }
                    }

                    int ParentID = 0;
                    List <TIM_TimesheetParentModel> PrevParentTimesheet = new List <TIM_TimesheetParentModel>();
                    PrevParentTimesheet = BalParentTimesheet.GetEmpTimesheetByTimesheetId(clientContext, EmpTimesheet[0].TimesheetID);
                    if (PrevParentTimesheet.Count == 0)
                    {
                        string ParentItemData = " 'EmployeeId': '" + Employee.ID + "'";
                        ParentItemData += " ,'TimesheetID': '" + EmpTimesheet[0].TimesheetID + "'";
                        ParentItemData += " ,'StatusId': '" + lstPendingStatus[0].ID + "'";
                        ParentItemData += " ,'InternalStatus': '" + InternalStatus + "'";
                        ParentItemData += " ,'ManagerId': '" + lstApprover[0].ID + "'";
                        ParentItemData += " ,'TimesheetAddedDate': '" + EmpTimesheet[0].TimesheetAddedDate + "'";
                        ParentID        = Convert.ToInt32(BalParentTimesheet.SaveTimesheet(clientContext, ParentItemData));
                        if (ParentID > 0)
                        {
                            var    count           = Convert.ToInt32(EmpTimesheet[0].TimesheetID.Split('-')[1]) + 1;
                            string SettingItemData = " 'TimesheetCount': '" + count + "'";
                            string resID           = BalSetting.UpdateSetting(clientContext, SettingItemData, "1");
                            if (resID != "Update")
                            {
                                obj.Add("ERROR");
                                return(Json(obj, JsonRequestBehavior.AllowGet));
                            }
                        }
                    }
                    else
                    {
                        ParentID = PrevParentTimesheet[0].ID;
                    }

                    string returnID = "0";
                    foreach (var item in EmpTimesheet)
                    {
                        string itemdata = " 'Description': '" + item.Description.Replace("'", @"\'") + "'";

                        itemdata += " ,'Hours': '" + item.Hours + "'";
                        itemdata += " ,'EstimatedHours': '" + item.EstimatedHours + "'";
                        itemdata += " ,'UtilizedHours': '" + item.UtilizedHours + "'";
                        itemdata += " ,'RemainingHours': '" + item.RemainingHours + "'";
                        itemdata += " ,'TimesheetAddedDate': '" + item.TimesheetAddedDate + "'";
                        itemdata += " ,'EmployeeId': '" + Employee.ID + "'";
                        itemdata += " ,'ManagerId': '" + lstApprover[0].ID + "'";
                        itemdata += " ,'FromTime': '" + item.FromTime + "'";
                        itemdata += " ,'ToTime': '" + item.ToTime + "'";
                        itemdata += " ,'AllTaskStatusId': '" + item.AllTaskStatus + "'";
                        itemdata += " ,'TimesheetID': '" + item.TimesheetID + "'";
                        itemdata += " ,'StatusId': '" + lstPendingStatus[0].ID + "'";
                        itemdata += " ,'InternalStatus': '" + InternalStatus + "'";
                        itemdata += " ,'ParentIDId': '" + ParentID + "'";

                        itemdata += " ,'OtherClient': '" + item.OtherClient + "'";
                        itemdata += " ,'OtherProject': '" + item.OtherProject + "'";
                        itemdata += " ,'OtherMilestone': '" + item.OtherMilestone + "'";
                        itemdata += " ,'OtherTask': '" + item.OtherTask + "'";

                        if (item.ID > 0)
                        {
                            if (item.AlterUtilizeHour != null && item.AlterUtilizeHour != "")
                            {
                                string status = GetAndEditPrevTimesheet(clientContext, item);
                                if (status != "OK")
                                {
                                    obj.Add("ERROR");
                                    return(Json(obj, JsonRequestBehavior.AllowGet));
                                }
                            }

                            returnID = BalEmpTimesheet.UpdateTimesheet(clientContext, itemdata, item.ID.ToString());
                            if (returnID == "Update")
                            {
                                if (Request.Files.Count > 0)
                                {
                                    UploadTimesheetDoc(clientContext, Request.Files, item, item.ID.ToString());
                                }
                                i++;
                            }
                        }
                        else
                        {
                            itemdata += " ,'ProjectId': '" + item.Project + "'";
                            itemdata += " ,'TaskId': '" + item.Task + "'";
                            itemdata += " ,'SubTaskId': '" + item.SubTask + "'";
                            itemdata += " ,'ClientId': '" + item.Client + "'";
                            itemdata += " ,'MileStoneId': '" + item.MileStone + "'";
                            returnID  = BalEmpTimesheet.SaveTimesheet(clientContext, itemdata);
                            if (Convert.ToInt32(returnID) > 0)
                            {
                                item.ParentID = ParentID;
                                string status = EditPrevTimesheetForNew(clientContext, item);
                                if (status != "OK")
                                {
                                    obj.Add("ERROR");
                                    return(Json(obj, JsonRequestBehavior.AllowGet));
                                }
                                else
                                {
                                    if (Request.Files.Count > 0)
                                    {
                                        UploadTimesheetDoc(clientContext, Request.Files, item, returnID);
                                    }

                                    string Mailres = EmailCtrl.TimesheetCreationNotification(clientContext, EmpTimesheet[0], lstApprover[0], Employee);
                                    if (Convert.ToInt32(Mailres) > 0)
                                    {
                                        i++;
                                    }
                                }
                            }
                        }
                    }

                    if (i == EmpTimesheet.Count)
                    {
                        obj.Add("OK");
                    }
                }
            }
            catch (Exception ex)
            {
                obj.Add("ERROR");
                return(Json(obj, JsonRequestBehavior.AllowGet));

                throw new Exception(string.Format("An error occured while performing action. GUID: {0}", ex.ToString()));
            }
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
        public override System.Web.Mvc.ActionResult Index(int?currentPageNum, int?pageSize, System.Web.Mvc.FormCollection collection)
        {
            if (!currentPageNum.HasValue)
            {
                currentPageNum = 1;
            }
            if (!pageSize.HasValue)
            {
                pageSize = PagedResult <Xzqy> .DefaultPageSize;
            }
            int    pageNum = currentPageNum.Value;
            string roleId  = LRequest.GetString("roleId");

            #region MyRegion
            ViewData["RoleId"] = roleId;
            DataTable dt = DbFactory.DBA.QueryDataTable("SELECT * FROM [Role] WHERE ID='" + roleId + "'");
            if (dt.Rows.Count > 0)
            {
                ViewData["RoleName"] = dt.Rows[0]["Name"].ToString();
            }
            else
            {
                ViewData["RoleName"] = "";
            }
            #endregion

            var list = repo.GetRoleAuthority(Guid.Parse(roleId));

            var contactLitViewModel = new PagedResult <RoleAuthority>(pageNum, pageSize.Value, list);

            return(View(contactLitViewModel));
        }
Exemplo n.º 47
0
        public ActionResult PatientLookup(System.Web.Mvc.FormCollection form)
        {
            ViewBag.statusMessage = "";
            using (HITProjectData_Fall17Entities1 newDB = new HITProjectData_Fall17Entities1())
            {
                List <patient_general_info> patientToCollection = new List <patient_general_info>();
                patient_general_info        patients            = null;

                string button = Request.Form["button"];


                string mrn  = Request.Form["mrn"];
                string ssn  = Request.Form["ssn1"];
                string last = Request.Form["last"];
                ViewBag.patient = ssn;
                ViewBag.mrn     = mrn;
                if (mrn.Length < 1 && ssn.Length < 1)
                {
                    if (last.Length < 1)
                    {
                        ViewBag.statusMessage = "Both fields were blank when the lookup was submitted";
                    }
                    else
                    {
                        patientToCollection = db.patient_general_info.Where(r => r.last_name.Contains(last)).ToList();
                        return(View("PatientResults", patientToCollection));
                    }
                }
                else if (mrn.Length > 0 && ssn.Length > 0)
                {
                    ViewBag.statusMessage = "Data was contained in both input fields. Please look up a patient by MRN or SSN, not both.";
                }
                else if (mrn.Length > 5 && mrn.Length < 7)
                {
                    patients = db.patient_general_info.Where(r => r.medical_record_number == mrn).FirstOrDefault();

                    if (patients != null)
                    {
                        if (patients.birth_date != null && patients.first_name != null)
                        {
                            patientToCollection.Add(patients);
                            return(View("PatientResults", patientToCollection));
                        }
                        else
                        {
                            ViewBag.patient = ssn;
                            return(View("Create"));
                        }
                    }
                    else
                    {
                        ViewBag.patientFound = false;
                        return(View());
                    }
                }
                else if (ssn.Length > 8 && ssn.Length < 10)
                {
                    patients = db.patient_general_info.Where(r => r.social_security_number == ssn).FirstOrDefault();

                    if (patients != null)
                    {
                        if (patients.birth_date != null && patients.first_name != null)
                        {
                            patientToCollection.Add(patients);
                            ViewBag.patient = ssn;
                            return(View("PatientResults", patientToCollection));
                        }
                        else
                        {
                            ViewBag.patient = ssn;
                            return(View("Create"));
                        }
                    }
                    else
                    {
                        patient p = db.patients.Where(r => r.social_security_number == ssn).FirstOrDefault();

                        if (p != null)
                        {
                            ViewBag.patient = p.social_security_number;
                            ViewBag.mrn     = p.medical_record_number;
                            return(View("Create"));
                        }
                        else
                        {
                            ViewBag.patientFound = false;
                            return(View());
                        }
                    }
                }
                else
                {
                    ViewBag.statusMessage = "Please make sure that the input is the proper length. MRN(6) SSN(9)";
                }

                //Input not filled in.
                return(View());
            }
        }
        public override System.Web.Mvc.ActionResult Index(int?currentPageNum, int?pageSize, System.Web.Mvc.FormCollection collection)
        {
            if (!currentPageNum.HasValue)
            {
                currentPageNum = 1;
            }
            if (!pageSize.HasValue)
            {
                pageSize = PagedListViewModel <SchoolInfoPageListViewModel> .DefaultPageSize;
            }

            string schoolId = LRequest.GetString("schoolId");

            var list = RF.Concrete <ISchoolInfoRepository>().GetSchoolTeacherList(Guid.Parse(schoolId));
            var contactLitViewModel = new PagedListViewModel <SchoolTeacherViewModel>(currentPageNum.Value, pageSize.Value, list);

            return(View(contactLitViewModel));
        }
Exemplo n.º 49
0
        public static ManagedFile UpdateStatus(Guid id, IScriptedTask task, IPrincipal principal, System.Web.Mvc.FormCollection form, ApplicationDbContext db)
        {
            var file = db.Files.Where(x => x.Id == id).Include(x => x.CatalogRecord).FirstOrDefault();

            if (!file.CatalogRecord.Curators.Any(x => x.UserName == principal.Identity.Name))
            {
                throw new HttpException(403, "Forbidden");
            }

            var status = db.TaskStatuses.Where(x =>
                                               x.CatalogRecord.Id == file.CatalogRecord.Id &&
                                               x.File.Id == file.Id &&
                                               x.TaskId == task.Id)
                         .FirstOrDefault();

            var user = db.Users.Where(x => x.UserName == principal.Identity.Name).FirstOrDefault();

            string result = form["result"];
            string notes  = form["notes"];

            // Add a note.
            if (!string.IsNullOrWhiteSpace(notes))
            {
                var note = new Note()
                {
                    CatalogRecord = file.CatalogRecord,
                    File          = file,
                    Timestamp     = DateTime.UtcNow,
                    User          = user,
                    Text          = notes
                };
                db.Notes.Add(note);
            }

            if (result == "Accept" ||
                result == "Not Applicable")
            {
                status.IsComplete    = true;
                status.CompletedBy   = user;
                status.CompletedDate = DateTime.UtcNow;

                string eventTitle = null;
                if (result == "Accept")
                {
                    eventTitle = "Accept task: " + task.Name;
                }
                else if (result == "Not Applicable")
                {
                    eventTitle = "Not applicable task: " + task.Name;
                }

                // Log the acceptance.
                var log = new Event()
                {
                    EventType            = EventTypes.AcceptTask,
                    Timestamp            = DateTime.UtcNow,
                    User                 = user,
                    RelatedCatalogRecord = file.CatalogRecord,
                    Title                = eventTitle,
                    Details              = notes,
                };

                log.RelatedManagedFiles.Add(file);

                db.Events.Add(log);
            }
            else if (result == "Undo")
            {
                status.IsComplete    = false;
                status.CompletedBy   = null;
                status.CompletedDate = null;

                // Log the rejection.
                var log = new Event()
                {
                    EventType            = EventTypes.RejectTask,
                    Timestamp            = DateTime.UtcNow,
                    User                 = user,
                    RelatedCatalogRecord = file.CatalogRecord,
                    Title                = "Task unaccepted: " + task.Name,
                    Details              = notes
                };

                log.RelatedManagedFiles.Add(file);

                db.Events.Add(log);
            }
            else
            {
                // Log the rejection.
                var log = new Event()
                {
                    EventType            = EventTypes.RejectTask,
                    Timestamp            = DateTime.UtcNow,
                    User                 = user,
                    RelatedCatalogRecord = file.CatalogRecord,
                    Title                = "Reject task: " + task.Name,
                    Details              = notes
                };

                log.RelatedManagedFiles.Add(file);

                db.Events.Add(log);
            }

            db.SaveChanges();

            return(file);
        }
Exemplo n.º 50
0
        public ActionResult DetailsUpdateAll(System.Web.Mvc.FormCollection form)
        {
            string  mrn     = Request.Form["mrn"];
            patient p       = db.patients.Where(r => r.medical_record_number == mrn).FirstOrDefault();
            user    account = db.users.Find(UserAccount.GetUserID());

            int patientID = p.patient_id;
            //Tables
            List <patient_name>       pn  = db.patient_name.Where(r => r.patient_id == patientID).ToList();
            List <patient_family>     pf  = db.patient_family.Where(r => r.patient_id == patientID).ToList();
            patient_birth_information pbi = db.patient_birth_information.Where(r => r.patient_id == patientID).FirstOrDefault();
            List <patient_address>    pa  = db.patient_address.Where(r => r.patient_id == patientID).ToList();
            List <patient_insurance>  pi  = db.patient_insurance.Where(r => r.patient_id == patientID).ToList();
            //Form inputs
            //PrimaryName
            string fName = Request.Form["firstName"];
            string mName = Request.Form["middleName"];
            string lName = Request.Form["lastName"];
            //NewAlias
            string AfName = Request.Form["AfirstName"];
            string AmName = Request.Form["AmiddleName"];
            string AlName = Request.Form["AlastName"];


            //Work out Patient Names
            if (pn.Any())
            {
                //Find Primary Name
                patient_name foundPrimary = db.patient_name.Where(r => r.patient_id == patientID && r.patient_name_type_id == 1).FirstOrDefault();
                if (foundPrimary != null)
                {                                              //if the patient has a primary name (Which they should)
                    if (foundPrimary.first_name != fName || foundPrimary.middle_name != mName || foundPrimary.last_name != lName)
                    {                                          //check if the primary name changed
                        foundPrimary.patient_name_type_id = 2; //change primary name to an alias.
                        foundPrimary.date_edited          = DateTime.Now;
                        foundPrimary.edited_by            = account.userId;
                        db.Entry(foundPrimary).State      = EntityState.Modified;
                        patient_name newPrimary = new patient_name();
                        newPrimary.patient_name_type_id = 1;
                        newPrimary.patient_id           = patientID;
                        newPrimary.first_name           = fName;
                        newPrimary.middle_name          = mName;
                        newPrimary.last_name            = lName;
                        newPrimary.date_added           = DateTime.Now;
                        db.patient_name.Add(newPrimary);
                        db.SaveChanges();
                    }
                    if (AfName.Length > 1 && AlName.Length > 1)
                    {//Add an Alias
                        patient_name newAlias = new patient_name();
                        newAlias.patient_name_type_id = 2;
                        newAlias.patient_id           = patientID;
                        newAlias.first_name           = AfName;
                        newAlias.middle_name          = AmName;
                        newAlias.last_name            = AlName;
                        newAlias.date_added           = DateTime.Now;
                        db.patient_name.Add(newAlias);
                        db.SaveChanges();
                    }
                }
            }
            //update any other General Info
            string motherMaidenName = Request.Form["mothersMaidenName"];
            string sex           = Request.Form["sex"];
            string gender        = Request.Form["gender"];
            int    maritalStatus = Convert.ToInt32(Request.Form["maritalStatus"]);
            int    race          = Convert.ToInt32(Request.Form["race"]);
            int    ethnicity     = Convert.ToInt32(Request.Form["ethnicity"]);
            int    changed       = 0;

            if (p.mother_maiden_name != motherMaidenName)
            {
                p.mother_maiden_name = motherMaidenName; changed++;
            }
            if (p.patient_ethnicity_id != ethnicity)
            {
                p.patient_ethnicity_id = ethnicity; changed++;
            }
            if (p.marital_status_id != maritalStatus)
            {
                p.marital_status_id = maritalStatus; changed++;
            }
            if (p.patient_race_id != race)
            {
                p.patient_race_id = race; changed++;
            }
            if (changed > 0)//if there were any changes, update patient record.
            {
                p.date_edited     = DateTime.Now;
                p.edited_by       = account.userId;
                db.Entry(p).State = EntityState.Modified;
            }
            string address  = Request.Form["address"];
            string address2 = Request.Form["address2"];
            string city     = Request.Form["city"];
            string state    = Request.Form["state"];
            string zip      = Request.Form["zip"];

            string addressBilling  = Request.Form["addressBilling"];
            string address2Billing = Request.Form["address2Billing"];
            string cityBilling     = Request.Form["cityBilling"];
            string stateBilling    = Request.Form["stateBilling"];
            string zipBilling      = Request.Form["zipBilling"];

            changed = 0;
            if (pa.Any())
            {
                patient_address primaryAddress = db.patient_address.Where(r => r.address_type_id == 1).FirstOrDefault();
                if (primaryAddress != null)
                {
                    if (primaryAddress.street_address_one != address || primaryAddress.street_address_two != address2)
                    {
                        changed++;
                        primaryAddress.address_type_id = 4;
                        primaryAddress.date_edited     = DateTime.Now;
                        primaryAddress.edited_by       = account.userId;
                        db.Entry(primaryAddress).State = EntityState.Modified;
                        patient_address newPrimary = new patient_address();
                        newPrimary.patient_id         = patientID;
                        newPrimary.street_address_one = address;
                        newPrimary.street_address_two = address2;
                        newPrimary.city            = city;
                        newPrimary.state           = state;
                        newPrimary.zip             = zip;
                        newPrimary.address_type_id = 1;
                        newPrimary.date_added      = DateTime.Now;
                        db.patient_address.Add(newPrimary);
                    }
                }
                else
                {
                    changed++;
                    patient_address newPrimary = new patient_address();
                    newPrimary.patient_id         = patientID;
                    newPrimary.street_address_one = address;
                    newPrimary.street_address_two = address2;
                    newPrimary.city            = city;
                    newPrimary.state           = state;
                    newPrimary.zip             = zip;
                    newPrimary.address_type_id = 1;
                    newPrimary.date_added      = DateTime.Now;
                    db.patient_address.Add(newPrimary);
                }
                patient_address primaryAddressBilling = db.patient_address.Where(r => r.address_type_id == 2).FirstOrDefault();
                if (primaryAddressBilling != null)
                {
                    if (primaryAddressBilling.street_address_one != addressBilling || primaryAddressBilling.street_address_two != address2Billing)
                    {
                        changed++;

                        patient_address newPrimaryBilling = new patient_address();
                        newPrimaryBilling.patient_id         = patientID;
                        newPrimaryBilling.street_address_one = addressBilling;
                        newPrimaryBilling.street_address_two = address2Billing;
                        newPrimaryBilling.city            = cityBilling;
                        newPrimaryBilling.state           = stateBilling;
                        newPrimaryBilling.zip             = zipBilling;
                        newPrimaryBilling.address_type_id = 2;
                        newPrimaryBilling.date_added      = DateTime.Now;
                        db.patient_address.Add(newPrimaryBilling);
                        primaryAddressBilling.address_type_id = 4;
                        primaryAddressBilling.date_edited     = DateTime.Now;
                        primaryAddressBilling.edited_by       = account.userId;
                        db.Entry(primaryAddressBilling).State = EntityState.Modified;
                    }
                }
                else
                {
                    changed++;
                    patient_address newPrimaryBilling = new patient_address();
                    newPrimaryBilling.patient_id         = patientID;
                    newPrimaryBilling.street_address_one = addressBilling;
                    newPrimaryBilling.street_address_two = address2Billing;
                    newPrimaryBilling.city            = cityBilling;
                    newPrimaryBilling.state           = stateBilling;
                    newPrimaryBilling.zip             = zipBilling;
                    newPrimaryBilling.address_type_id = 2;
                    newPrimaryBilling.date_added      = DateTime.Now;
                    db.patient_address.Add(newPrimaryBilling);
                }
            }
            else  //If no addresses exist add them
            {
                if (address.Length > 1 || address2.Length > 1 || city.Length > 1 || state.Length > 1 || zip.Length > 1)
                {
                    changed++;
                    patient_address newAddress = new patient_address();
                    newAddress.patient_id         = patientID;
                    newAddress.street_address_one = address;
                    newAddress.street_address_two = address2;
                    newAddress.city            = city;
                    newAddress.state           = state;
                    newAddress.zip             = zip;
                    newAddress.address_type_id = 1;
                    newAddress.date_added      = DateTime.Now;
                    db.patient_address.Add(newAddress);
                }
                if (addressBilling.Length > 1 || address2Billing.Length > 1 || cityBilling.Length > 1 || stateBilling.Length > 1 || zipBilling.Length > 1)
                {
                    changed++;
                    patient_address newAddressBilling = new patient_address();
                    newAddressBilling.patient_id         = patientID;
                    newAddressBilling.street_address_one = addressBilling;
                    newAddressBilling.street_address_two = address2Billing;
                    newAddressBilling.city            = cityBilling;
                    newAddressBilling.state           = stateBilling;
                    newAddressBilling.zip             = zipBilling;
                    newAddressBilling.address_type_id = 2;
                    newAddressBilling.date_added      = DateTime.Now;
                    db.patient_address.Add(newAddressBilling);
                }
            }
            if (changed > 0)
            {//If address is added or updated, save the changes.
                db.SaveChanges();
            }

            ViewBag.patientId = mrn;
            return(View("Details", new { id = mrn }));
        }
Exemplo n.º 51
0
 partial void NewOrderOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Web.Mvc.FormCollection form);
Exemplo n.º 52
0
        public ActionResult CreateGeneral(System.Web.Mvc.FormCollection form)
        {
            string  mrn = Request.Form["mrn"];
            patient p   = db.patients.Where(r => r.medical_record_number == mrn).FirstOrDefault();

            try
            {
                user account = db.users.Find(UserAccount.GetUserID());

                int patientID = p.patient_id;

                patient_name              pn     = new patient_name();
                patient_family            mother = new patient_family();
                patient_family            father = new patient_family();
                patient_birth_information pbi    = db.patient_birth_information.Where(r => r.patient_id == patientID).FirstOrDefault();

                // Update patient's patient table

                p.gender_id            = Convert.ToInt32(Request.Form["gender"]);
                p.mother_maiden_name   = Request.Form["mothersMaidenName"];
                p.date_edited          = DateTime.Now;
                p.marital_status_id    = Convert.ToInt32(Request.Form["maritalStatus"]);
                p.patient_ethnicity_id = Convert.ToInt32(Request.Form["ethnicity"]);
                p.patient_race_id      = Convert.ToInt32(Request.Form["race"]);
                if (Request.Cookies["userId"] != null)
                {
                    HttpCookie aCookie = Request.Cookies["userId"];
                    p.edited_by = Convert.ToInt32(Server.HtmlEncode(aCookie.Value));
                }
                db.Entry(p).State = EntityState.Modified;
                db.SaveChanges();
                //update patient's name table
                //Primary Name
                pn.first_name           = Request.Form["firstName"];
                pn.middle_name          = Request.Form["middleName"];
                pn.last_name            = Request.Form["lastName"];
                pn.patient_id           = patientID;
                pn.patient_name_type_id = 1; //Find this in db later
                pn.date_added           = DateTime.Now;

                db.patient_name.Add(pn);
                db.SaveChanges();
                string aliasFirstName  = Request.Form["AfirstName"];
                string aliasMiddleName = Request.Form["AmiddleName"];
                string aliasLastName   = Request.Form["AlastName"];

                if (aliasFirstName.Length > 1 && aliasLastName.Length > 1)
                {
                    patient_name pna = new patient_name();
                    pna.first_name           = aliasFirstName;
                    pna.middle_name          = aliasMiddleName;
                    pna.last_name            = aliasLastName;
                    pna.patient_id           = patientID;
                    pna.patient_name_type_id = 2;
                    pna.date_added           = DateTime.Now;

                    db.patient_name.Add(pna);
                    db.SaveChanges();
                }
                if (pbi != null)
                {
                }
                else
                {
                    patient_birth_information newPBI = new patient_birth_information();
                    newPBI.birth_date = DateTime.Parse(Request.Form["dob"]).Date;
                    newPBI.patient_id = patientID;
                    newPBI.date_added = DateTime.Now;
                    db.patient_birth_information.Add(newPBI);
                    db.SaveChanges();
                }

                //logger.Info("User " + account.firstName + " " + account.lastName + " created patient: " + p.medical_record_number);
                // return View("Details", new { id = p.medical_record_number });
                return(Redirect("Details/" + p.medical_record_number));
            }
            catch (DbEntityValidationException dbEx)
            {
                //return View("Details", new { id = p.medical_record_number });
                return(Redirect("Details/" + p.medical_record_number));
            }
        }
Exemplo n.º 53
0
        public override System.Threading.Tasks.Task <System.Web.Mvc.ActionResult> Delete(string id, System.Web.Mvc.FormCollection collection)
        {
            var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Delete);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "collection", collection);
            DeleteOverride(callInfo, id, collection);
            return(System.Threading.Tasks.Task.FromResult(callInfo as ActionResult));
        }
Exemplo n.º 54
0
 public ActionResult UserHomeOperations(System.Web.Mvc.FormCollection frmCollection, string submitButton)
 {
     try
     {
         int          ID = 0;
         string       tweetMsg;
         string       errmsg    = "";
         TweetHandler twtHandlr = new TweetHandler();
         if (submitButton == "share")
         {
             ID       = Convert.ToInt32(frmCollection["UsrID"]);
             tweetMsg = frmCollection["msgTweet"];
             if (ID != 0)
             {
                 twtHandlr.PostTweet(ID, tweetMsg);
             }
             else
             {
                 errmsg = "Could not read user properly";
             }
         }
         else if (submitButton.Contains("Save"))
         {
             ID       = Convert.ToInt32(frmCollection["TweetID"].Split(',')[0]);
             tweetMsg = frmCollection["msgEdtTweet"];
             if (ID != 0)
             {
                 twtHandlr.UpdateTweet(ID, tweetMsg);
             }
             else
             {
                 errmsg = "Could not read tweet properly";
             }
         }
         else if (submitButton == "Delete")
         {
             ID = Convert.ToInt32(frmCollection["TweetID"].Split(',')[0]);
             if (ID != 0)
             {
                 twtHandlr.DeleteTweet(ID);
             }
             else
             {
                 errmsg = "Could not read tweet properly";
             }
         }
         else if (submitButton == "Cancel")
         {
             Redirect(Request.UrlReferrer.ToString());
         }
         else if (submitButton == "Search")
         {
             if (string.IsNullOrEmpty(frmCollection["txtSearch"]))
             {
                 throw new Exception("Search criteria cannot by empty");
             }
             else
             {
                 UserSearch   srchUser  = new UserSearch();
                 UsersHandler usrHandlr = new UsersHandler();
                 srchUser = usrHandlr.GetUserDetails(frmCollection["txtSearch"]);
                 if (srchUser != null)
                 {
                     srchUser.sourceUsrID = Convert.ToInt32(frmCollection["UsrID"]);
                     //SearchPage(srchUser);
                     return(RedirectToAction("SearchPage", "Search", srchUser));
                 }
             }
         }
         return(Redirect(Request.UrlReferrer.ToString()));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
         return(Redirect(Request.UrlReferrer.ToString()));
     }
 }
Exemplo n.º 55
0
        public ActionResult InviteUser(User newUser, FormCollection collection)
        {
            var userLogin = User as ApplicationUser;

            try
            {
                var band = _userUILogic.NotFoundUserWithEmail(newUser.Email);

                if (band)
                {
                    var currentTenancy = TenantManager.CurrentTenancy;
                    if (currentTenancy.Equals(Tenants.SuperAdmin, StringComparison.OrdinalIgnoreCase))
                    {
                        //It should create a tenant
                        var tenantToInvite = collection.GetValue("selectedTenant").AttemptedValue.Split('/').Last();
                        _userUILogic.SendInvitation(newUser, tenantToInvite, currentTenancy, Request.Url, userLogin);
                    }

                    else
                    {
                        _userUILogic.SendInvitation(newUser, currentTenancy, Request.Url, userLogin);
                    }

                    var toUrl = Request.UrlReferrer;
                    if (toUrl != null)
                    {
                        return(Redirect(toUrl.AbsoluteUri));
                    }
                }

                TempData.Add("CurrentInvite", newUser);
                TempData.Add("MessageError", "Email already invited, try with another email");

                ModelState.AddModelError("Email", "Email already invited, try with another email");
                return(RedirectToAction("Index", new { reload = true }));
            }

            catch (Exception ex)
            {
                ExceptionHandler.Manage(ex, this, Layer.UILogic);

                if (ex.InnerException != null)
                {
                    _log.ErrorFormat("{0} \n InnerException: {1}", ex, ex.InnerException);
                }
                else if (userLogin != null)
                {
                    _log.ErrorFormat(
                        "Current User: {0} - An exception occurred with the following message: {1}",
                        userLogin.UserName,
                        ex.Message);
                }

                const string smtpExceptionMessage = "Failure to send the email, please check the SMTP configuration";
                TempData.Remove("MessageError");
                TempData.Add("MessageError", smtpExceptionMessage);

                TempData.Remove("CurrentInvite");
                TempData.Add("CurrentInvite", newUser);

                return(RedirectToAction("Index", new { reload = true }));
            }
        }
Exemplo n.º 56
0
 partial void GetDocumentsPostOverride(T4MVC_System_Web_Mvc_JsonResult callInfo, System.Web.Mvc.FormCollection form);
Exemplo n.º 57
0
        public ActionResult Register(FormCollection formVars)
        {
            string id = formVars["Id"];

            if (!string.IsNullOrEmpty(formVars["btnDeleteAccount"]))
            {
                if (string.IsNullOrEmpty(AppUserState.UserId))
                {
                    return(View("Register", ViewModel));
                }

                if (!busUser.Delete(AppUserState.UserId))
                {
                    ViewModel.ErrorDisplay.ShowError("Unable to delete this account: " + busUser.ErrorMessage);
                }
                else
                {
                    IdentitySignout();
                    return(RedirectToAction("New", "Snippet"));
                }

                return(View("Register", ViewModel));
            }

            ViewData["IsNew"] = false;

            string confirmPassword = formVars["confirmPassword"];

            bool isNew = false;
            User user  = null;

            if (string.IsNullOrEmpty(id) || busUser.Load(id) == null)
            {
                user = busUser.NewEntity();
                ViewData["IsNew"] = true;

                // not validated yet
                user.InActive = true;
                isNew         = true;
            }
            else
            {
                user = busUser.Entity;
            }

            UpdateModel <User>(busUser.Entity,
                               new string[] { "Name", "Email", "Password", "Theme" });

            if (ModelState.Count > 0)
            {
                ErrorDisplay.AddMessages(ModelState);
            }

            if (string.IsNullOrEmpty(user.OpenId) &&
                confirmPassword != user.Password)
            {
                ErrorDisplay.AddMessage("Please make sure both password values match.", "confirmPassword");
            }


            if (ErrorDisplay.DisplayErrors.Count > 0)
            {
                return(View("Register", ViewModel));
            }

            if (!busUser.Validate())
            {
                ErrorDisplay.Message = "Please correct the following:";
                ErrorDisplay.AddMessages(busUser.ValidationErrors);
                return(View("Register", ViewModel));
            }

            if (!busUser.Save())
            {
                ErrorDisplay.ShowError("Unable to save User: "******"Register", ViewModel));
            }

            AppUserState appUserState = new AppUserState();

            appUserState.FromUser(user);
            IdentitySignin(appUserState, appUserState.UserId);

            if (isNew)
            {
                SetAccountForEmailValidation();

                ErrorDisplay.HtmlEncodeMessage = false;
                ErrorDisplay.ShowMessage(
                    @"Thank you for creating an account...
<hr />
<p>Before you can post and save new CodePastes we need to
verify your email address.</p>
<p>We just sent you an email with a confirmation
code. Please follow the instructions in the email 
to validate your email address.</p>");

                return(View("Register", ViewModel));
            }


            return(RedirectToAction("New", "Snippet", null));
        }
Exemplo n.º 58
0
        public IActionResult Register(a.FormCollection Fc)
        {
            var UserName = Fc["firstName"].ToString();

            return(Content($"Hello {UserName}"));
        }
Exemplo n.º 59
0
        public ActionResult CheckOut(System.Web.Mvc.FormCollection checkout)
        {
            ViewBag.Bread = "Checkout";
            if (Session["Customer"] == null)
            {
                string returnurl = Request.Url.LocalPath.ToString();
                return(RedirectToAction("Login", "Customer", new { Returnurl = returnurl }));
            }
            Order order = new Order();

            order.CustomerId       = ((Customer)Session["Customer"]).CustomerId;
            order.RestaurantId     = ((Cart)Session["Cart"]).restaurantsess.RestaurantId;
            order.Amount           = (double)((Cart)Session["Cart"]).cartSummary.GrossTotal;
            order.DeliveryStatus   = "Not Confirmed";
            order.IsOrderConfirmed = false;
            order.VATPercent       = ((Cart)Session["Cart"]).cartSummary.VATPercent;
            order.RestaurantServiceChargePercent = ((Cart)Session["Cart"]).cartSummary.ServiceChargePercent;
            order.DeliveryCharge = 0;

            string a = checkout["rdbcheckout"].ToString();

            if (checkout["rdbcheckout"].ToString() == "Delivertome")
            {
                order.FullName               = checkout["txtFName"];
                order.DeliveryAddress        = checkout["txtAddress"];
                order.Phone                  = checkout["txtPhone"];
                order.NearestLocation        = checkout["Location"];
                order.DeliveryMeOrSelfPickup = "Delivery To Me";
            }
            else
            {
                order.FullName               = "NA";
                order.DeliveryAddress        = "NA";
                order.Phone                  = "NA";
                order.NearestLocation        = "NA";
                order.DeliveryMeOrSelfPickup = "Pick up";
            }
            if (checkout["rdbAsSoonAs"] == "AsSoonAsPossible")
            {
                order.Take_awayDateTime = "As soon as possible";
            }
            else
            {
                order.Take_awayDateTime = checkout["DeliveryDate"].ToString() + " - " + checkout["DeliveryTime"];
            }
            order.DateTime = DateTime.Now;
            db.Orders.Add(order);
            db.SaveChanges();
            int orderid = order.OrderId;
            List <CartDetail> orderlist = ((Cart)Session["Cart"]).cartDetail;

            foreach (CartDetail cd in orderlist)
            {
                OrderDetail orderdetail = new OrderDetail();
                orderdetail.FoodItemId = cd.FoodItemId;
                orderdetail.Quantity   = cd.Quantity;
                orderdetail.Rate       = (double)cd.Rate;
                orderdetail.OrderId    = orderid;
                db.OrderDetails.Add(orderdetail);
                db.SaveChanges();
            }
            //MessageBox.Show("Your order has been placed for confirmation");
            ViewData["Location"] = new SelectList(db.Locations, "LocationName", "LocationName");
            Session["Cart"]      = null;
            string msg = "Order placed successfully";

            return(RedirectToAction("OrderHistory", "Customer", new { Msg = msg }));
        }
        public override System.Web.Mvc.ActionResult SubmitWidgetForm(long instanceId, System.Web.Mvc.FormCollection collection)
        {
            var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.SubmitWidgetForm);

            callInfo.RouteValueDictionary.Add("instanceId", instanceId);
            callInfo.RouteValueDictionary.Add("collection", collection);
            return(callInfo);
        }