Beispiel #1
0
        public ActionResult SaveMovement()
        {
            //For several movements at same time should use json
            //string[] movs = operations.Split('|');

            string operations = null;
            operations = HttpContext.Request.Form[0].ToString();

            if (operations == null)
                return View();

            string[] vars = operations.ToString().Split(';');
            //    var sendstr = "-1;true;" + ";" + mtype + ";" + cattype + ";" + subcattype + ";" + movamount + ";" + movdescription + ";" + dipckerdate;
            using (SGFEntitiess accM = new SGFEntitiess())
            {
                AccountDataModel acc = (AccountDataModel)Session["accountOnline"];
                AccountModel user = (AccountModel)Session["userOnline"];

                Int32? subcat = null;
                try{
                    subcat = Int32.Parse(vars[4]);
                }
                catch(Exception e){}

                //Add new Movement
                SGF_T_ACCOUNT_MOVEMENT accMov = SGF_T_ACCOUNT_MOVEMENT.CreateSGF_T_ACCOUNT_MOVEMENT(Int32.Parse(vars[0]), acc.Account_Id, Int32.Parse(vars[2]), Int32.Parse(vars[3]), subcat, (decimal)Double.Parse(vars[5]), vars[6].ToString(), user.Name.ToString(), DateTime.Parse(vars[7]));

                accM.AddToSGF_T_ACCOUNT_MOVEMENT(accMov);

                //commit changes
                accM.SaveChanges();
            }

            return View();
        }