Exemplo n.º 1
0
 public static DateTime GetFormDateTimeValue(string name, FormCollection collection)
 {
     if (collection == null || collection.Count <= 0)
     {
         return(DateTime.MinValue);
     }
     if (!DateTime.TryParse(collection.Get(name), out var value))
     {
         value = DateTime.MinValue;
     }
     return(value);
 }
Exemplo n.º 2
0
 public ActionResult Edit(int id, FormCollection collection)
 {
     try
     {
         // TODO: Add update logic here
         CuentaGastos cg = new CuentaGastos()
         {
             FechaFinal     = DateTime.Parse(collection.Get("FechaFinal")),
             FechaInicial   = DateTime.Parse(collection.Get("FechaInicial")),
             NumeroAcreedor = collection.Get("NumeroAcreedor"),
             Descripcion    = collection.Get("Descripcion"),
             IdCuentaGastos = Int32.Parse(collection.Get("IdCuentaGastos"))
         };
         cg.modificarCuentaGasto();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 3
0
 public static int GetFormNumberValue(string name, FormCollection collection)
 {
     if (collection == null || collection.Count <= 0)
     {
         return(0);
     }
     if (!int.TryParse(collection.Get(name), out var value))
     {
         value = 0;
     }
     return(value);
 }
Exemplo n.º 4
0
 public static double GetFormFloatingPointeValue(string name, FormCollection collection)
 {
     if (collection == null || collection.Count <= 0)
     {
         return(0);
     }
     if (!double.TryParse(collection.Get(name), out var value))
     {
         value = 0.0;
     }
     return(value);
 }
        public ActionResult ReportKilos(FormCollection collection)
        {
            /*var query = from DetProd in db.detalle_produccion
             *          join Costo in db.costo on DetProd.cabecera_recetaId equals Costo.cabecera_recetaId*/
            var query = from DetProd in db.detalle_produccion
                        join PreVenta in db.precio_venta on DetProd.cabecera_recetaId equals PreVenta.cabecera_recetaId
                        join Costo in db.costo on DetProd.cabecera_recetaId equals Costo.cabecera_recetaId
                        where DetProd.cabecera_recetaId != 1
                        group DetProd by DetProd.fechacosto >= Convert.ToDateTime(collection.Get("id"));

            return(View());
        }
Exemplo n.º 6
0
        public ActionResult GoToProduct(FormCollection formCollection)
        {
            var productId = formCollection.Get("Products");

            var product = Mockdata.Mockdata.GetMockProduct(Convert.ToInt32(productId));

            var model = new EcommerceViewModel {
                Product = product
            };

            return(View("~/Views/Ecommerce/Product.cshtml", model));
        }
Exemplo n.º 7
0
        public ActionResult Add(FormCollection formCollection)
        {
            var userId      = GetSession.UserId;
            var toDoService = new WCFService.ToDoService();
            var request     = new AddToDoRq {
                Name = formCollection.Get("name") ?? "", UserId = userId
            };
            var result = toDoService.AddToDo(request);

            ViewBag.RedirectToDoId = result.ToDoId;
            return(RedirectToAction("GetToDo", new { id = result.ToDoId }));
        }
Exemplo n.º 8
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         _corporationService.DeleteCorporation(collection.Get("CorporationId"));
         return(View("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 9
0
        public ActionResult Index(FormCollection f, string id)
        {
            string   sTaiKhoan = f.Get("UserName").ToString();
            string   sMatKhau  = f.Get("Password").ToString();
            SinhVien sv        = qlsv.SinhVien.SingleOrDefault(a => a.MSSV == sTaiKhoan && a.MatKhau == sMatKhau);

            if (sv != null)
            {
                ViewBag.ThongBao       = "Chúc mừng bạn đăng nhập thành công";
                Session["TaiKhoan"]    = sTaiKhoan;
                Session["Tensinhvien"] = sv.HoLot + " " + sv.Ten;
                sTaiKhoan = id;

                return(RedirectToAction("Index", "Home"));
            }
            if (sv == null)
            {
                ViewBag.ThongBao = "Tên tài khoản hoặc mật khẩu không đúng";
            }
            return(View());
        }
Exemplo n.º 10
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                Dog dog = new Dog();
                dog.Id = new Guid();

                dog.Name   = collection.Get("Name");
                dog.Age    = int.Parse(collection.Get("Age"));
                dog.Weight = int.Parse(collection.Get("Weight"));
                dog.Breed  = collection.Get("Breed");

                dogs.Add(dog);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 11
0
        public ActionResult makaleDuzenle(makaleler m, FormCollection frm)
        {
            int katid   = Convert.ToInt32(frm.Get("kategoriler"));
            int yazarid = Convert.ToInt32(frm.Get("yazarlar"));

            var makaleD = vt.makalelers.First(x => x.ID == m.ID);

            makaleD.makaleAdi         = m.makaleAdi;
            makaleD.makale            = m.makale;
            makaleD.kategoriID        = katid;
            makaleD.makaleTitle       = m.makaleTitle;
            makaleD.makaleKeyword     = m.makaleKeyword;
            makaleD.makaleDescription = m.makaleDescription;
            makaleD.yazarID           = yazarid;
            vt.SubmitChanges();
            KategorilerMakaleD(katid);
            yazarlarMakaleD(yazarid);
            ViewBag.duzenle = "makale duzenlendi";

            return(View());
        }
Exemplo n.º 12
0
        public ActionResult ResetPassword(FormCollection collection)
        {
            var user = UserManager.FindById(Session["reset_userid"].ToString());

            UserManager.RemovePassword(user.Id);
            var store        = new UserStore <ApplicationUser>(context);
            var new_password = UserManager.PasswordHasher.HashPassword(collection.Get("password"));

            store.SetPasswordHashAsync(user, new_password);
            context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 13
0
        public ViewResult Index(int?page, int?pagesize, FormCollection fc)
        {
            var user  = OperatorProvider.Provider.Current();
            var total = 0;
            var name  = fc.Get("name");
            var data  = workmeetingbll.GetBaseData(user.DeptId, name, string.Empty, pagesize ?? 15, page ?? 1, out total);

            ViewBag.pages   = Math.Ceiling((decimal)total / (pagesize ?? 15));
            ViewBag.current = page ?? 1;
            ViewBag.name    = name;
            return(View(data));
        }
Exemplo n.º 14
0
        public ActionResult Detail(FormCollection collection)
        {
            int eid      = collection.Get("Eid").ToInt32(); //该兑换id
            var exchange = _exchangeService.Find(eid);

            if (exchange.Examine != "3")
            {
                return(Json(Com.Cos.Common.Public.MessageJson(0, "该兑换不在兑换状态!")));
            }

            return(Json(Com.Cos.Common.Public.MessageJson(1, "")));
        }
Exemplo n.º 15
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                Movie movie = new Movie();
                movie.Id = new Guid();

                movie.Title    = collection.Get("Title");
                movie.Duration = int.Parse(collection.Get("Duration"));
                movie.Genre    = collection.Get("Genre");
                movie.Year     = int.Parse(collection.Get("Year"));

                movies.Add(movie);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 16
0
 public ActionResult Edit(int id, FormCollection collection)
 {
     try
     {
         var model = new NewsEntity.Models.City();
         model.Name = collection.Get("Name");
         model.Url_Primpogoda_Weather_Now   = collection.Get("Url_Primpogoda_Weather_Now");
         model.Url_Primpogoda_Weather_Today = collection.Get("Url_Primpogoda_Weather_Today");
         model.Save();
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         string err = ex.Message;
         if (ex.InnerException != null)
         {
             err += ": " + ex.InnerException.Message;
         }
         return(RedirectToAction("Index", "City", new { error = err, notice = "" }));
     }
 }
Exemplo n.º 17
0
        private SelectList GenerateSelectList(IEnumerable items, string dataValue, string dataText)
        {
            if (_state == SelectListState.Create)
            {
                return(new SelectList(items, dataValue, dataText));
            }

            var formCollection = new FormCollection(_filterContext.HttpContext.Request.Form);
            var selectedValue  = formCollection.Get(_property);

            return(selectedValue != null ? new SelectList(items, dataValue, dataText, selectedValue) : new SelectList(items, dataValue, dataText));
        }
Exemplo n.º 18
0
        public ActionResult Create(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                Admin.Models.Milestones.Milestones mem = new Admin.Models.Milestones.Milestones();
                var milelist = new List <Admin.Models.Milestones.Milestones>();

                ViewData["ProjectID"] = id;
                string Deadline          = collection.Get("date1");
                var    date              = DateTime.Parse(Deadline);
                var    selectedProjectID = Int32.Parse(Session["SelectedProjectID"].ToString());
                model.Createmilestones(selectedProjectID, collection.Get("MilestonesTitle"), collection.Get("MilestonesDescription"), collection.Get("Status"), date);
                Session["SelectedProjectID"] = id;
                return(View("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 19
0
 public ActionResult Login(FormCollection f)
 {
     //Kiểm tra đăng nhập
     if (f["txtUsername"].ToString() == "Admin" && f.Get("txtPassword").ToString() == "123456")
     {
         Session["username"] = "******";
         Session["password"] = "******";
         return(RedirectToAction("QuanLyBanAn", "Admin"));
     }
     ViewBag.Login = "******";
     return(View());
 }
Exemplo n.º 20
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                Book book = new Book();
                book.Id = new Guid();

                book.Title  = collection.Get("Title");
                book.Author = collection.Get("Author");
                book.Genre  = collection.Get("Genre");
                book.Year   = int.Parse(collection.Get("Year"));

                books.Add(book);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
 public ActionResult Create([Bind(Include = "DepartmentManagerId,UserId,DepartmentId,Position")] WeFix.WebUI.Models.DashboardViewModel departmentManager, FormCollection collection)
 {
     try
     {
         int               deptId  = Convert.ToInt32(collection.Get("deptId"));
         string            userId  = Convert.ToString(collection.Get("ManagerUserId"));
         DepartmentManager deptMan = new DepartmentManager()
         {
             DepartmentId = deptId,
             Position     = departmentManager.Position,
             UserId       = userId
         };
         db.DepartmentManagers.Add(deptMan);
         db.SaveChanges();
         return(RedirectToAction("Management", "Organisations", null));
     }
     catch
     {
         return(RedirectToAction("Management", "Organisations", null));
     }
 }
Exemplo n.º 22
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                User user;

                using (IUnitOfWork unitOfWork = new TskDataDataContext(DbUtil.ConnectionString))
                {
                    IUserRep userRep = new UserRep(unitOfWork);
                    user = userRep.FindById(id);

                    if (Brilliantech.Tsk.Manage.WebApp.Util.CustomMembershipProvider.CanEdit(user.Name))
                    {
                        ViewData["Role"] = new SelectList(UserRoleModel.UserRoleList(), "Key", "Name", user.Role);
                        if (collection.Get("Password").Trim().Length < CustomMembershipProvider.MinRequiredPasswordLength)
                        {
                            ViewBag.Message = "密码长度小于" + CustomMembershipProvider.MinRequiredPasswordLength;
                            return(View(user));
                        }
                        else
                        {
                            user.Password = collection.Get("Password").Trim();
                            user.Role     = collection.Get("Role");
                            user.Email    = collection.Get("Email");
                            unitOfWork.Submit();
                            return(RedirectToAction("Index"));
                        }
                    }
                    else
                    {
                        TempData["Message"] = "初始管理员,不可以编辑";
                        return(RedirectToAction("Index"));
                    }
                }
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 23
0
        public ActionResult Edit(FormCollection form)
        {
            string id = form.Get("ID");

            if (!string.IsNullOrEmpty(id))
            {
                try
                {
                    Statement stateModel = db.Statement.Where(e => e.ID == int.Parse(id)).FirstOrDefault();
                    stateModel.ItemID    = int.Parse(form.Get("ItemID"));
                    stateModel.Money     = decimal.Parse(form.Get("Money"));
                    stateModel.Type      = int.Parse(form.Get("Type"));
                    stateModel.OccurTime = Convert.ToDateTime(form.Get("OccurTime"));
                    stateModel.Remark    = form.Get("Remark");
                    db.SubmitChanges();
                    code = "ok";
                    info = "保存成功!";
                }
                catch (Exception ex)
                {
                    code = "Error";
                    info = "修改失败!";
                }
                return(Content(Common.Json.ResultMes(code, info)));
            }
            else
            {
                code = "Error";
                info = "数据有问题!";
                return(Content(Common.Json.ResultMes(code, info)));
            }
        }
Exemplo n.º 24
0
        //新增或修改財務項目
        public String addSubject(FormCollection form)
        {
            logger.Info("form:" + form.Count);
            string msg = "";
            //懶得把Form綁FIN_SUBJECT 直接先把Form 值填滿
            FIN_SUBJECT s = new FIN_SUBJECT();

            if (null != form.Get("subject_id").Trim() && form.Get("subject_id").Trim() != "")
            {
                s.FIN_SUBJECT_ID = form.Get("subject_id").Trim();
            }
            else
            {
                s.FIN_SUBJECT_ID = form.Get("new_subject_id").Trim();
            }
            s.SUBJECT_NAME = form.Get("subject_name").Trim();
            s.CATEGORY     = form.Get("categorys").Trim();
            int i = service.addNewSubject(s);

            if (i == 0)
            {
                msg = service.message;
            }
            else
            {
                msg = "項目更新成功";
            }

            logger.Info("Request:SUBJECT_ID=" + s.FIN_SUBJECT_ID);
            return(msg);
        }
Exemplo n.º 25
0
        public ActionResult Register(FormCollection form)
        {
            if (ModelState.IsValid)
            {
                IwanttobuyCustomer iwanttobuyCustomer = new IwanttobuyCustomer();
                iwanttobuyCustomer.CustomerName    = form.Get("CustomerName");
                iwanttobuyCustomer.CustomerSurname = form.Get("CustomerSurname");
                iwanttobuyCustomer.Email           = form.Get("Email");
                iwanttobuyCustomer.PhoneNo         = form.Get("PhoneNo");
                iwanttobuyCustomer.Address         = form.Get("Address");
                iwanttobuyCustomer.TextPassword    = form.Get("TextPassword");
                byte[] encrypt = Encryption.Encrypt(iwanttobuyCustomer.TextPassword);
                iwanttobuyCustomer.Password     = encrypt;
                iwanttobuyCustomer.CreateDate   = DateTime.Now.AddHours(7);
                iwanttobuyCustomer.CustomerType = "C";
                iwanttobuyCustomer.NoOfLogin    = 0;
                db.IwanttobuyCustomers.Add(iwanttobuyCustomer);
                db.SaveChanges();
                TempData["Message"] = String.Format("คุณ {0} {1} ลงทะเบียนเสร็จสมบูรณ์", iwanttobuyCustomer.CustomerName.ToString(), iwanttobuyCustomer.CustomerSurname.ToString());
                TempData["Type"]    = "success";
                return(RedirectToAction("Index"));
            }

            return(View("Index"));
        }
Exemplo n.º 26
0
 public ActionResult AsiDuzenleKaydet(FormCollection f)
 {
     try
     {
         int    id  = Convert.ToInt32(f.Get("eId"));
         string adi = f.Get("eAdi");
         if (String.IsNullOrEmpty(adi))
         {
             return(hata("Aşı düzenlenemedi. Lütfen gerekli alanların doldurulduğundan emin olup tekrar deneyin"));
         }
         string   kontrendikasyon  = f.Get("eKontrendikasyon");
         int      minyas           = Convert.ToInt32(f.Get("eMinUygulamaYasi"));
         int      maxyas           = Convert.ToInt32(f.Get("eMaxUygulamaYasi"));
         int      periyod          = Convert.ToInt32(f.Get("eIslemPeriyodu"));
         DateTime degistirmeTarihi = DateTime.Now;
         Asi      eski             = db.Asis.Find(id);
         eski.Adi              = adi;
         eski.Kontrendikasyon  = kontrendikasyon;
         eski.MinUygulamaYasi  = minyas;
         eski.MaxUygulamaYasi  = maxyas;
         eski.IslemPeriyodu    = periyod;
         eski.DuzenlenmeTarihi = degistirmeTarihi;
         db.SaveChanges();
         return(onayyenile("Aşı başarıyla düzenlendi"));
     }
     catch
     {
     }
     return(hata("Aşı düzenlenemedi. Lütfen gerekli alanların doldurulduğundan emin olup tekrar deneyin"));
 }
Exemplo n.º 27
0
        public async Task <ActionResult> Edit(String id, FormCollection collection)
        {
            try
            {
                Usuario usuario = await GetUsuarioById(id);

                if (usuario != null)
                {
                    usuario.Password       = collection.Get("Password");
                    usuario.NombreCompleto = collection.Get("NombreCompleto");
                    usuario.Dni            = collection.Get("Dni");
                    usuario.Localizacion   = collection.Get("Localizacion");
                    usuario.Meteorologia   = collection.Get("Meteorologia");
                    using (var client = new HttpClient())
                    {
                        client.BaseAddress = new Uri(Baseurl);
                        client.DefaultRequestHeaders.Clear();
                        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                        HttpResponseMessage Res = await client.PutAsJsonAsync(string.Concat("api/Usuarios/", id), usuario);

                        if (Res.IsSuccessStatusCode)
                        {
                            return(RedirectToAction("Index"));
                        }
                        else
                        {
                            return(View());
                        }
                    }
                }
                else
                {
                    return(View());
                }
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 28
0
        public ActionResult SaveInfoBeacon(FormCollection form)
        {
            Beacon beacon = new Beacon();
            Random random = new Random();

            beacon.MACID  = random.Next(1, 100);
            beacon.ShopID = random.Next(1, 1000);
            //beacon.LocationX = Convert.ToInt64(form.Get("txtCordinateX"));
            //beacon.LocationY = Convert.ToInt64(form.Get("txtCordinateY"));
            //

            //String a = Request["LocX"].ToString();
            //String b = Request["LocY"].ToString();

            String a = form.Get("txtCordinateX");

            if (form.Get("txtCordinateX") != null && form.Get("txtCordinateY") != null)
            {
                beacon.LocationX = Convert.ToDecimal(form.Get("txtCordinateX").ToString());
                beacon.LocationY = Convert.ToDecimal(form.Get("txtCordinateY").ToString());
                new CodeBeacon().insert(beacon);
            }
            else
            {
                beacon.LocationX = Convert.ToDecimal(form.Get("txtCordinateX").ToString());
            }

            return(View("Index"));
        }
Exemplo n.º 29
0
        public JsonResult SearchDeliveryBills(FormCollection fc)
        {
            string account   = fc.Get("account");
            string fromDate  = fc.Get("fromDate");
            string toDate    = fc.Get("toDate");
            string itemModel = fc.Get("itemModel");
            string stockNo   = fc.Get("stockNo");
            string customer  = fc.Get("customer");

            DateTime fromDateDt, toDateDt;

            if (!DateTime.TryParse(fromDate, out fromDateDt))
            {
                fromDateDt = DateTime.Now.AddDays(-3);
            }
            if (!DateTime.TryParse(toDate, out toDateDt))
            {
                toDateDt = DateTime.Now.AddDays(1);
            }
            else
            {
                toDateDt = toDateDt.AddDays(1);
            }

            Wlog(string.Format("account:{0},fromDate:{1:yyyy-MM-dd},toDate:{2:yyyy-MM-dd},model:{3},stockNo:{4},customer:{5}", account, fromDateDt, toDateDt, itemModel, stockNo, customer));

            try {
                var result = new EqmSv().SearchDeliveryBills(account, stockNo, fromDateDt, toDateDt, customer, itemModel);
                return(Json(new { suc = true, result = result }));
            }
            catch (Exception ex) {
                return(Json(new { suc = false, msg = ex.Message }));
            }
        }
Exemplo n.º 30
0
        public ActionResult Create(FormCollection formCollection)
        {
            try
            {
                DatabaseEntities db = new DatabaseEntities();

                int     id       = db.account.Count() + 1;
                String  email    = formCollection.Get("email");
                String  password = formCollection.Get("password");
                String  address  = formCollection.Get("address");
                String  phoneNum = formCollection.Get("phoneNum");
                int     role     = int.Parse(formCollection.Get("role"));
                Boolean status   = Boolean.Parse(formCollection.Get("status"));

                account ac = new account();
                ac.id       = id;
                ac.email    = email;
                ac.password = password;
                ac.address  = address;
                ac.phoneNum = phoneNum;
                ac.role     = role;
                ac.status   = status;

                db.account.Add(ac);
                db.SaveChanges();

                return(RedirectToAction("Index", "Home"));
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }