コード例 #1
0
        //[ValidateAntiForgeryToken]
        //swamini123456
        public JsonResult CreateEdit()
        {
            tblfinancialyear tblfinancial = new tblfinancialyear();
            var financial = new FinancialViewModel();

            try
            {
                //if (financial.ID <= 0)
                //{
                //    dd._context.tblfinancialyears.Add(tblfinancial);
                //}
                //else
                //{
                //    tblfinancial = dd._context.tblfinancialyears.Where(x => x.FinancialyearID == financial.ID).FirstOrDefault();
                //}
                FId          = 1;
                tblfinancial = dd._context.tblfinancialyears.Where(x => x.FinancialyearID == FId).FirstOrDefault();
                if (tblfinancial != null)
                {
                    string        cnnString = System.Configuration.ConfigurationManager.ConnectionStrings["c1"].ConnectionString;
                    SqlConnection cnn       = new SqlConnection(cnnString);
                    SqlCommand    cmd       = new SqlCommand();
                    cmd.Connection  = cnn;
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "generateFinancialYear";
                    //add any parameters the stored procedure might require
                    cnn.Open();
                    object o = cmd.ExecuteNonQuery();
                    cnn.Close();
                }
                else
                {
                    DateTime thisDate    = DateTime.Now;
                    string   currentyear = DateTime.Now.ToString("yyyy");
                    DateTime nextyear    = thisDate.AddYears(1);
                    financial.FinancialYearFrom = "01/04/" + currentyear;
                    financial.FinancialYearTo   = "31/03/" + nextyear.Year;

                    tblfinancial.Financialyearfrom = Convert.ToDateTime(financial.FinancialYearFrom);
                    tblfinancial.Financialyearto   = Convert.ToDateTime(financial.FinancialYearTo);
                    tblfinancial.StartDate         = Convert.ToDateTime(financial.FinancialYearFrom);
                    tblfinancial.EndDate           = Convert.ToDateTime(financial.FinancialYearTo);
                    tblfinancial.CompID            = 1;
                    tblfinancial.Financialyear     = "April" + tblfinancial.Financialyearfrom.Year + "-" + "March" + tblfinancial.Financialyearto.Year;
                    dd._context.tblfinancialyears.Add(tblfinancial);
                    dd._context.SaveChanges();
                }
                FId          = dd._context.tblfinancialyears.Max(x => x.FinancialyearID);
                financial.ID = FId;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(Json(financial));
        }
コード例 #2
0
        // GET: /<controller>/
        public async Task <IActionResult> Financial()
        {
            var states = await _localization.GetStates();

            var viewModel = new FinancialViewModel()
            {
                States = states
            };

            return(View(viewModel));
        }
コード例 #3
0
        public IActionResult Put([FromBody] FinancialViewModel financial)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return Response(financial);
            }

            _appService.Update(financial);

            return Response("Financial successfully updated");
        }
コード例 #4
0
        public ActionResult GetFinancialYearById(int ID)
        {
            string operation = Session["Operation"].ToString();

            ButtonVisiblity(operation);
            tblfinancialyear   tblyear = dd._context.tblfinancialyears.Where(x => x.FinancialyearID == ID).FirstOrDefault();
            FinancialViewModel year    = new FinancialViewModel();

            year.ID = tblyear.FinancialyearID;
            year.FinancialYearFrom = tblyear.Financialyearfrom.ToShortDateString();
            year.FinancialYearTo   = tblyear.Financialyearto.ToShortDateString();
            year.operation         = operation;
            return(View("FinancialYear", year));
        }
コード例 #5
0
        public ActionResult FinancialYear()
        {
            ButtonVisiblity("Index");
            var model = new FinancialViewModel();
            tblfinancialyear tblyear = dd._context.tblfinancialyears.Where(x => x.FinancialyearID == 1).FirstOrDefault();

            if (tblyear != null)
            {
                model.ID = tblyear.FinancialyearID;
                model.FinancialYearFrom = tblyear.Financialyearfrom.ToShortDateString();
                model.FinancialYearTo   = tblyear.Financialyearto.ToShortDateString();
            }
            return(View(model));
        }
コード例 #6
0
        public ActionResult UploadFinancial()
        {
            var list = _baseFunctions.GetPartners();

            FinancialViewModel model = new FinancialViewModel
            {
                PartnerList = new List <SelectListItem>(list.Select(x => new SelectListItem {
                    Text = x.PARTNER_NAME, Value = x.PARTNER_ID.ToString()
                })),
                Date = DateTime.Now
            };

            return(View(model));
        }
コード例 #7
0
        public ActionResult UpdateFinancial(int id)
        {
            var financialItem = _baseFunctions.GetFinancialItemByID(id);

            FinancialViewModel model = new FinancialViewModel()
            {
                ID          = financialItem.ID,
                Amount      = financialItem.AMOUNT.ToString(),
                Date        = financialItem.DATE,
                PartnerList = _baseFunctions.GetPartners().Select(p => new SelectListItem
                {
                    Text  = p.PARTNER_NAME,
                    Value = p.PARTNER_ID.ToString()
                }).ToList(),
                SelectedPartnerID = financialItem.PARTNER_ID
            };

            return(View(model));
        }
コード例 #8
0
        public ActionResult SaveFinancialItem(FinancialViewModel model)
        {
            if (ModelState.IsValid)
            {
                FinancialItem financialItem = new FinancialItem()
                {
                    PARTNER_ID = model.SelectedPartnerID,
                    AMOUNT     = Convert.ToDecimal(model.Amount),
                    DATE       = model.Date
                };

                int success = _baseFunctions.InsertFinancialItem(financialItem);

                if (success == 1)
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(View("UploadFinancial", model));
        }
コード例 #9
0
        public ActionResult Index()
        {
            var model = new FactFindViewModel();

            var xmldoc = new XmlDataDocument();

            ViewData["Selected"] = "Domestic";

            XmlNodeList xmlnode;
            XmlNodeList xmlcareer;

            string path = HttpContext.Server.MapPath("~/App_Data/FactFind.xml");

            FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);

            xmldoc.Load(fs);
            fs.Close();
            fs.Dispose();

            xmlnode = xmldoc.GetElementsByTagName("StudentId");

            model.Asset       = xmldoc.GetElementsByTagName("Asset")[0].InnerXml;
            model.Expenditure = xmldoc.GetElementsByTagName("Expenditure")[0].InnerXml;
            model.Income      = xmldoc.GetElementsByTagName("Income")[0].InnerXml;
            model.Liablity    = xmldoc.GetElementsByTagName("Liablity")[0].InnerXml;

            path   = HttpContext.Server.MapPath("~/App_Data/Career.xml");
            xmldoc = new XmlDataDocument();
            fs     = new FileStream(path, FileMode.Open, FileAccess.Read);
            xmldoc.Load(fs);
            fs.Close();
            fs.Dispose();

            xmlcareer = xmldoc.GetElementsByTagName("career");

            var academic = xmldoc.GetElementsByTagName("academic")[0].InnerXml;

            var nonAcademic = xmldoc.GetElementsByTagName("nonacademic")[0].InnerXml;

            academic    = academic.Replace(" ", "");
            nonAcademic = nonAcademic.Replace(" ", "");

            path   = HttpContext.Server.MapPath("~/App_Data/Domestic.xml");
            xmldoc = new XmlDataDocument();
            fs     = new FileStream(path, FileMode.Open, FileAccess.Read);
            xmldoc.Load(fs);
            fs.Close();
            fs.Dispose();

            var currentAcademicCost    = xmldoc.GetElementsByTagName(academic)[0].InnerXml;
            var currentNonAcademicCost = xmldoc.GetElementsByTagName(nonAcademic)[0].InnerXml;

            path   = HttpContext.Server.MapPath("~/App_Data/Careertype.xml");
            xmldoc = new XmlDataDocument();
            fs     = new FileStream(path, FileMode.Open, FileAccess.Read);
            xmldoc.Load(fs);
            fs.Close();
            fs.Dispose();

            xmlcareer = xmldoc.GetElementsByTagName("Career");

            var academictype = xmldoc.GetElementsByTagName("Type")[0].InnerXml;

            var costtocalculate = (academictype == "Academic" ? currentAcademicCost : currentNonAcademicCost);

            var AspirationCost = financialService.FutureCost(Convert.ToDecimal(costtocalculate), 8, 7);

            var assestCost     = financialService.FutureCost(Convert.ToDecimal(model.Asset), 8, 7);
            var financialModel = new FinancialViewModel();

            financialModel.ActualCost = assestCost;

            financialModel.ProjectedCost = AspirationCost;

            financialModel.Years     = 7;
            financialModel.ShortFall = AspirationCost - assestCost;

            System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(FinancialViewModel));

            path = HttpContext.Server.MapPath("~/App_Data/FinancialRecommendation.xml");

            System.IO.FileStream file = System.IO.File.Create(path);

            writer.Serialize(file, financialModel);
            file.Close();

            return(View());
        }