Esempio n. 1
0
        private void DeletePeriods(string scheduleId)
        {
            try
            {
                VacationPeriodsListRequest req = new VacationPeriodsListRequest();
                req.VacationScheduleId = scheduleId;
                ListResponse <VacationSchedulePeriod> oldPeriods = _branchService.ChildGetAll <VacationSchedulePeriod>(req);

                if (!oldPeriods.Success)
                {
                    Common.errorMessage(oldPeriods);
                    return;
                }
                oldPeriods.Items.ForEach(x =>

                {
                    PostRequest <VacationSchedulePeriod> oldPeriodsRequest = new PostRequest <VacationSchedulePeriod>();
                    oldPeriodsRequest.entity = x;
                    PostResponse <VacationSchedulePeriod> oldPeriodsResponse = _branchService.ChildDelete <VacationSchedulePeriod>(oldPeriodsRequest);
                    if (!oldPeriodsResponse.Success)
                    {
                        Common.errorMessage(oldPeriods);
                        throw new Exception();
                    }
                });
            }
            catch
            {
            }
        }
Esempio n. 2
0
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            int    id   = Convert.ToInt32(e.ExtraParams["id"]);
            string type = e.ExtraParams["type"];

            switch (type)
            {
            case "ColName":
                //Step 1 : get the object from the Web Service
                panelRecordDetails.ActiveIndex = 0;
                RecordRequest r = new RecordRequest();
                r.RecordID = id.ToString();
                RecordResponse <VacationSchedule> response = _branchService.ChildGetRecord <VacationSchedule>(r);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, response.Summary).Show();
                    return;
                }
                //Step 2 : call setvalues with the retrieved object
                this.BasicInfoTab.SetValues(response.result);

                VacationPeriodsListRequest req = new VacationPeriodsListRequest();
                req.VacationScheduleId = r.RecordID;
                ListResponse <VacationSchedulePeriod> periods = _branchService.ChildGetAll <VacationSchedulePeriod>(req);
                periodsGrid.Store[0].DataSource = periods.Items;
                periodsGrid.Store[0].DataBind();
                periodsGrid.DataBind();
                // InitCombos(response.result);
                this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditRecordWindow.Show();
                break;

            case "colDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteRecord({0})", id),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "colAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }