예제 #1
0
        protected void LnkBtnApplyTemplate_Click(object sender, EventArgs e)
        {
            //per ogni template del tipo selezionato recupera gli eventi template e li inserisce sull'evento corrente
            //---
            TemplateDetailPageManager   ObjTemplateDetailPageManager   = new TemplateDetailPageManager();
            TrackManagement2PageManager ObjTrackManagement2PageManager = new TrackManagement2PageManager();

            ////recupera il template
            //TemplateDTO ObjTemplateDTO;
            //ObjTemplateDTO = ObjTemplateDetailPageManager.GetTemplate(Convert.ToInt32(CboTemplates.SelectedValue));
            try
            {
                if (CboTemplates.SelectedValue != "0")
                {
                    Evento ObjEvento = ObjTrackManagement2PageManager.GetAsyncEvento("events/" + Request.QueryString["evtId"].ToString()).Result;
                    //Recupera gli eventi del template
                    List <EventoDTO> LstEvtDto = ObjTemplateDetailPageManager.GetTemplateEvents(Convert.ToInt32(CboTemplates.SelectedValue));
                    foreach (EventoDTO CurrEvt in LstEvtDto)
                    {
                        Evento ObjInsertEvtInput = new Evento(); //data = "{'id': 99,'houseId':6}";
                        ObjInsertEvtInput.amount            = CurrEvt.amountNoFormat;
                        ObjInsertEvtInput.bankReportEntryId = Convert.ToInt32(Request.QueryString["bankReportEntryId"]);

                        ObjInsertEvtInput.date            = ObjEvento.date;
                        ObjInsertEvtInput.description     = CurrEvt.description;
                        ObjInsertEvtInput.eventTypeId     = CurrEvt.eventTypeId;
                        ObjInsertEvtInput.filePath        = CurrEvt.filePath;
                        ObjInsertEvtInput.houseId         = CurrEvt.houseId;
                        ObjInsertEvtInput.landlordId      = CurrEvt.landlordId;
                        ObjInsertEvtInput.partyId         = CurrEvt.partyId;
                        ObjInsertEvtInput.id              = 0;
                        ObjInsertEvtInput.invoiceId       = CurrEvt.invoiceId;
                        ObjInsertEvtInput.reminderDate    = CurrEvt.reminderDate;
                        ObjInsertEvtInput.reminderMessage = CurrEvt.reminderMessage;


                        ObjTrackManagement2PageManager.NewEvt(ObjInsertEvtInput);
                    }
                    BindBrotherEvts();
                }
            }
            catch (Exception ex)
            {
                PrintError(ex);
            }
        }
예제 #2
0
        protected void LnkBtnSplit_Click(object sender, EventArgs e)
        {
            TrackManagement2PageManager ObjTrackManagement2PageManager = new TrackManagement2PageManager();
            //recupera l'evento da cui si arriva

            Evento ObjEvento = null;

            try
            {
                ObjEvento = ObjTrackManagement2PageManager.GetAsyncEvento("events/" + Request.QueryString["evtId"].ToString()).Result;


                Evento ObjInsertEvtInput = new Evento(); //data = "{'id': 99,'houseId':6}";
                ObjInsertEvtInput.amount            = ObjEvento.amount;
                ObjInsertEvtInput.bankReportEntryId = ObjEvento.bankReportEntryId;
                //ObjInsertEvtInputDto.date = ObjEvento.date != null ? ObjEvento.date.Value.ToString("yyyy-MM-ddThh:mm:ss"):null;  //.ToString("yyyy-MM-dd");  //2018-10-04T07:11:09.833+0000
                ObjInsertEvtInput.date            = ObjEvento.date; //.ToString("yyyy-MM-dd");  //2018-10-04T07:11:09.833+0000
                ObjInsertEvtInput.description     = ObjEvento.description;
                ObjInsertEvtInput.eventTypeId     = ObjEvento.eventTypeId;
                ObjInsertEvtInput.filePath        = ObjEvento.filePath;
                ObjInsertEvtInput.houseId         = ObjEvento.houseId;
                ObjInsertEvtInput.landlordId      = ObjEvento.landlordId;
                ObjInsertEvtInput.partyId         = ObjEvento.partyId;
                ObjInsertEvtInput.id              = 0;
                ObjInsertEvtInput.invoiceId       = ObjEvento.invoiceId;
                ObjInsertEvtInput.reminderDate    = ObjEvento.reminderDate;
                ObjInsertEvtInput.reminderMessage = ObjEvento.reminderMessage;

                //inserisce i nuovi eventi
                int NumberEvtToCreate = Convert.ToInt32(CboSplitNumber.Value);
                for (int i = 0; i < NumberEvtToCreate; i++)
                {
                    ObjTrackManagement2PageManager.NewEvt(ObjInsertEvtInput);
                }

                BindBrotherEvts();
            }
            catch (Exception ex)
            {
                PrintError(ex);
            }
        }