Exemplo n.º 1
0
        public ActionResult CreateFinance(string desc, int fromID, int toID, string sum, int typeID, int projectID, int statusID)
        {
            var mng = new FinanceManager();

            int?fromID_ = null;

            if (fromID != 0)
            {
                fromID_ = fromID;
            }

            int?toID_ = null;

            if (toID != 0)
            {
                toID_ = toID;
            }

            int?typeID_ = null;

            if (typeID != 0)
            {
                typeID_ = typeID;
            }

            int?projectID_ = null;

            if (projectID != 0)
            {
                projectID_ = projectID;
            }

            int?statusID_ = null;

            if (statusID != 0)
            {
                statusID_ = statusID;
            }

            var item = new fin_finances
            {
                id        = 0,
                created   = DateTime.Now,
                fromID    = fromID_,
                toID      = toID_,
                desc      = desc,
                channelID = null,
                sum       = RDL.Convert.StrToDecimal(sum, 0),
                projectID = projectID_,
                typeID    = typeID_,
                statusID  = statusID_
            };

            mng.SaveFinFinance(item);

            return(Json(new
            {
                result = item.id > 0,
                financeID = item.id
            }));
        }