public ActionResult ProjectEventPaymentGenerator(int RepperID, int BudgetID)
        {
            if (RepperID > 0 && BudgetID > 0)
            {
                ReportPeriodListR repper = GetRepper(RepperID, BudgetID);

                ProjectEventService pes = new ProjectEventService();
                ProjectEvent        o   = new ProjectEvent();
                o.CompletedDate    = repper.PaymentDate;
                o.EventDescription = "Payment Request";
                o.ProjectID        = BudgetID;
                //o.EventType = GetPaymentEventType();
                o.EventTypeID    = GetPaymentEventType().EventTypeID;
                o.ReportPeriodID = RepperID;
                o.SSPOrGrantee   = true;
                o.EventStatus    = 0;
                pes.Insert(o);

                EventTemplate   eh = new EventTemplate();
                TemplateService ts = new TemplateService();

                TemplateDocument td1 = null;
                td1 = ts.GetTemplateDocument("Запрос на Оплату");
                if (td1 != null)
                {
                    eh.CreateFromTemplate(td1.TemplateDocsID, BudgetID, o.EventID, RepperID);
                }
            }

            return(RedirectToAction("Reppers", new { id = BudgetID }));
        }
        public bool CreateReportPeriod(ReportPeriodListR item)
        {
            //     Insert must not work if any article exists in this Budget.

            //    return budrep.CreateReportPeriod(item);

            if (GetFinArticleCategory(item.BudgetID).Count() == 0) //If No BUDGET
            {
                return(budrep.CreateReportPeriod(item));
            }
            else //IF BUDGET EXISTS
            {
                if (budrep.CreateReportPeriod(item)) //if success.
                { //
                    IEnumerable <FinArticleCategoryR> fincats = GetFinArticleCategory(item.BudgetID);
                    List <ReportPeriodR> ReportPeriods        = new List <ReportPeriodR>();

                    foreach (FinArticleCategoryR fincat in fincats)
                    {  //insert article itself.
                        ReportPeriodR repper = new ReportPeriodR();
                        repper.ReportPeriodID  = item.ReportPeriodID;
                        repper.FinArticleCatID = fincat.FinArticleCatID;
                        repper.Amount          = 0;
                        ReportPeriods.Add(repper);
                    }

                    return(budrep.InsertArticleToReportPeriodR(ReportPeriods));
                }

                return(false);
            }
        }
 public ActionResult Insert(int id)
 {
     if (RedirectIfAccessFin())
     {
         ViewData["ProposalID"] = id;
         ViewData["BudgetID"]   = id; //suppose to be BudgetID.
         ReportPeriodListR r = new ReportPeriodListR();
         //because View requires Object ReportPeriod because of it is strongly typed
         return(View(r));
     }
     else
     {
         return(RedirectToAction("Index", "Error", new { error = "Bugdet can't be changed." }));
     }
 }
Ejemplo n.º 4
0
        public bool CreateReportPeriod(ReportPeriodListR item)
        {
            BOTADataContext db     = new BOTADataContext(connectString);
            bool            result = true;

            try
            {
                db.ReportPeriodListRs.InsertOnSubmit(item);
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                result = false;
            }
            return(result);
        }
        public ActionResult Insert(ReportPeriodListR repperiod, int id)
        {
            //Insert INTO DB.
            if (RedirectIfAccessFin())
            {
                if (repperiod.PeriodStart.HasValue && repperiod.PeriodStart.HasValue)
                {
                    repperiod.PeriodTitle = repperiod.PeriodStart.Value.ToShortDateString() + "<br />" +
                                            repperiod.PeriodEnd.Value.ToShortDateString();
                }

                repperiod.PaymentStatus = 1;

                bool status = budservice.CreateReportPeriod(repperiod);

                return(RedirectToAction("Reppers", new { id = id }));
            }
            else
            {
                return(RedirectToAction("Index", "Error", new { error = "Bugdet can't be changed." }));
            }
        }
        public ActionResult ProjectEventAcceptanceMemoGenerator(int RepperID, int BudgetID)
        {
            if (RepperID > 0 && BudgetID > 0)
            {
                ReportPeriodListR repper = GetRepper(RepperID, BudgetID);

                //Create Event.
                ProjectEventService pes = new ProjectEventService();
                ProjectEvent        o   = new ProjectEvent();
                o.CompletedDate    = repper.PaymentDate;
                o.EventDescription = "Letter to Grantee";
                o.ProjectID        = BudgetID;
                //o.EventType = GetPaymentEventType();
                o.EventTypeID    = GetPaymentEventType().EventTypeID;
                o.ReportPeriodID = RepperID;
                o.SSPOrGrantee   = true;
                o.EventStatus    = 0;

                pes.Insert(o);

                EventTemplate   eh = new EventTemplate();
                TemplateService ts = new TemplateService();

                //Generate Document.
                TemplateDocument td1 = null;
                td1 = ts.GetTemplateDocument("письмо о принятии отчета");
                if (td1 != null)
                {
                    eh.CreateFromTemplate(td1.TemplateDocsID, BudgetID, o.EventID, RepperID);
                }
            }

            return(RedirectToAction("Index", "Events", null));

            // return RedirectToAction("Reppers", new { id = BudgetID });
        }