Exemplo n.º 1
0
        protected void Store1_RefreshData(object sender, StoreReadDataEventArgs e)
        {
            //GEtting the filter from the page
            string filter     = string.Empty;
            int    totalCount = 1;



            //Fetching the corresponding list

            //in this test will take a list of News
            ListRequest request = new ListRequest();

            request.Filter = "";
            ListResponse <LeaveType> routers = _leaveManagementService.ChildGetAll <LeaveType>(request);

            routers.Items.ForEach(x =>
                                  { if (x.leaveType != 1 && x.leaveType != 2)
                                    {
                                        x.leaveType = 1;
                                    }
                                  }
                                  );
            if (!routers.Success)
            {
                Common.errorMessage(routers);
            }
            this.Store1.DataSource = routers.Items;
            e.Total = routers.Items.Count;;

            this.Store1.DataBind();
        }
Exemplo n.º 2
0
        private void FillApprovalsStore(string leaveId, string employeeId, string returnType)
        {
            ReportGenericRequest req = new ReportGenericRequest();

            req.paramString = "8|" + leaveId;



            ListResponse <Model.LeaveManagement.LeaveReturnApproval> response = _leaveManagementService.ChildGetAll <Model.LeaveManagement.LeaveReturnApproval>(req);

            if (!response.Success)
            {
                Common.errorMessage(response);
                return;
            }
            List <XMLDictionary> statusList = Common.XMLDictionaryList(_systemService, "13");

            response.Items.ForEach(x =>
            {
                x.stringStatus = statusList.Where(y => y.key == x.status).Count() != 0 ? statusList.Where(y => y.key == x.status).First().value : string.Empty;
            }
                                   );
            ApprovalsStore.DataSource = response.Items;
            ApprovalsStore.DataBind();
        }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
0
        private string GetltId(string ltRef)
        {
            ListRequest request = new ListRequest();

            request.Filter = "";
            ListResponse <LeaveType> response = _leaveManagementService.ChildGetAll <LeaveType>(request);

            if (response == null || response.Items == null)
            {
                return(ltRef);
            }

            if (response.Items.Where(x => x.reference == ltRef).ToArray() == null)
            {
                return(ltRef);
            }
            else
            {
                if (response.Items.Where(x => x.reference == ltRef).ToList().Count() != 0)
                {
                    return(response.Items.Where(x => x.reference == ltRef).ToList().First().recordId);
                }
                else
                {
                    return(ltRef);
                }
            }
        }
Exemplo n.º 5
0
        private void FillVacationSchedule()
        {
            ListRequest vsRequest = new ListRequest();
            ListResponse <VacationSchedule> resp = _leaveManagementService.ChildGetAll <VacationSchedule>(vsRequest);

            VacationScheduleStore.DataSource = resp.Items;
            VacationScheduleStore.DataBind();
        }
Exemplo n.º 6
0
        private void FillVS()
        {
            ListRequest req = new ListRequest();
            ListResponse <VacationSchedule> resp = _leaveManagementService.ChildGetAll <VacationSchedule>(req);

            if (!resp.Success)
            {
                Common.errorMessage(resp);
                return;
            }
            VSStore.DataSource = resp.Items;
            VSStore.DataBind();
        }
        //[DirectMethod]
        //public void CalcReturnDate(object sender, DirectEventArgs e)
        //{
        //    DateTime startDate, endDate, returnDate;
        //    try
        //    {
        //        startDate = DateTime.Parse(e.ExtraParams["startDate"]);
        //        endDate = DateTime.Parse(e.ExtraParams["endDate"]);
        //        returnDate = DateTime.Parse(e.ExtraParams["returnDate"]);
        //        //LeaveChanged.Text = "1";
        //    }
        //    catch
        //    {

        //        panelRecordDetails.ActiveTabIndex = 0;
        //        return;
        //    }
        //    if (startDate == DateTime.MinValue || endDate == DateTime.MinValue)
        //    {

        //        return;
        //    }
        //    string startDay = startDate.ToString("yyyyMMdd");
        //    string returnDay = returnDate.ToString("yyyyMMdd");

        //    LeaveCalendarDayListRequest req = new LeaveCalendarDayListRequest();
        //    req.StartDayId = startDay;
        //    req.EndDayId = returnDay;
        //    req.IsWorkingDay = true;
        //    int bulk;
        //    if (string.IsNullOrEmpty(employeeId.Value.ToString()) || !int.TryParse(employeeId.Value.ToString(), out bulk))
        //    {

        //        return;
        //    }
        //    req.employeeId = employeeId.Value.ToString();
        //    //if (req.CaId == "0")
        //    //{

        //    //    X.Msg.Alert(Resources.Common.Error, GetLocalResourceObject("ErrorNoCalendar").ToString()).Show();
        //    //    return;

        //    //}

        //    ListResponse<LeaveCalendarDay> days = _helpFunctionService.ChildGetAll<LeaveCalendarDay>(req);
        //    if (!days.Success)
        //    {
        //        X.Msg.Alert(Resources.Common.Error, days.Summary).Show();
        //        return;
        //    }
        //    List<LeaveDay> leaveDays = new List<LeaveDay>();
        //    days.Items.ForEach(x => leaveDays.Add(new LeaveDay() { dow = (short)DateTime.ParseExact(x.dayId, "yyyyMMdd", new CultureInfo("en")).DayOfWeek, dayId = x.dayId, workingHours = x.workingHours, leaveHours = x.workingHours }));
        //    leaveDaysStore.DataSource = leaveDays;
        //    leaveDaysStore.DataBind();
        //    X.Call("CalcSum");
        //    if (returnDate > endDate)
        //    {
        //        X.Call("EnableLast");
        //    }
        //}
        public void FillLeaveType()
        {
            ListRequest req = new ListRequest();

            ListResponse <LeaveType> response = _leaveManagementService.ChildGetAll <LeaveType>(req);

            if (!response.Success)
            {
                Common.errorMessage(response);
                return;
            }
            ltStore.DataSource = response.Items;
            ltStore.DataBind();
        }
Exemplo n.º 8
0
        private void FillLT()
        {
            ListRequest req = new ListRequest();
            ListResponse <LeaveType> resp = _employeeService.ChildGetAll <LeaveType>(req);

            if (!resp.Success)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(resp);
                return;
            }

            ltStore.DataSource = resp.Items;
            ltStore.DataBind();
        }
Exemplo n.º 9
0
        public object FillParent(string action, Dictionary <string, object> extraParams)
        {
            StoreRequestParameters prms = new StoreRequestParameters(extraParams);



            List <VacationSchedule> data;
            ListRequest             req = new ListRequest();

            ListResponse <VacationSchedule> response = _branchService.ChildGetAll <VacationSchedule>(req);

            data = response.Items;
            return(new
            {
                data
            });
        }
Exemplo n.º 10
0
        protected void Store1_RefreshData(object sender, StoreReadDataEventArgs e)
        {
            List <XMLDictionary> statusList = Common.XMLDictionaryList(_systemService, "13");

            //GEtting the filter from the page
            string filter     = string.Empty;
            int    totalCount = 1;



            //Fetching the corresponding list

            //in this test will take a list of News
            LeaveRequestListRequest request = GetFilteredRequest();

            request.Size    = "50";
            request.StartAt = e.Start.ToString();
            request.SortBy  = "recordId";
            request.Params  = vals.Text;

            //request.Filter = "";
            ListResponse <LeaveRequest> routers = _leaveManagementService.ChildGetAll <LeaveRequest>(request);

            if (!routers.Success)
            {
                Common.errorMessage(routers);
                return;
            }
            routers.Items.ForEach(x =>
            {
                x.statusString = statusList.Where(y => y.key == x.apStatus).Count() != 0 ? statusList.Where(y => y.key == x.apStatus).First().value : "";
            }

                                  );

            this.Store1.DataSource = routers.Items;
            e.Total = routers.count;

            this.Store1.DataBind();
        }
Exemplo n.º 11
0
        protected DataTable getData(string month, string year)
        {
            LeaveRequestListRequest req = GetFilteredRequest();

            ListResponse <LeaveRequest> resp = _leaveManagementService.ChildGetAll <LeaveRequest>(req);

            if (!resp.Success)
            {
                X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", resp.ErrorCode) != null ? GetGlobalResourceObject("Errors", resp.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + resp.LogId : resp.Summary).Show();
                return(new DataTable());
            }
            DataTable dt;

            dt = new DataTable();
            dt.Columns.Add("start", typeof(DateTime));
            dt.Columns.Add("end", typeof(DateTime));
            dt.Columns.Add("name", typeof(string));
            dt.Columns.Add("id", typeof(string));
            dt.Columns.Add("resource", typeof(string));
            dt.Columns.Add("backColor", typeof(string));

            DataRow dr;

            DateTime startDate = new DateTime(Convert.ToInt32(year), Convert.ToInt32(month), 1);
            DateTime endDate   = new DateTime(Convert.ToInt32(year), Convert.ToInt32(month), DateTime.DaysInMonth(Convert.ToInt32(year), Convert.ToInt32(month)));

            List <string> employeeid = new List <string>();

            foreach (var item in resp.Items)
            {
                if (item.startDate > endDate || item.endDate < startDate)
                {
                    continue;
                }

                if (!employeeid.Contains(item.employeeId))
                {
                    DayPilotScheduler1.Resources.Add(new DayPilot.Web.Ui.Resource(item.employeeName, item.employeeId.ToString()));
                    employeeid.Add(item.employeeId);
                }

                dr             = dt.NewRow();
                dr["id"]       = item.recordId;
                dr["start"]    = item.startDate;
                dr["end"]      = item.endDate.AddDays(1);
                dr["name"]     = item.employeeName;
                dr["resource"] = item.employeeId;
                switch (item.apStatus)
                {
                case -1:
                    dr["backColor"] = "#ccff00";
                    break;

                case 0:
                    dr["backColor"] = "#00ff00";
                    break;

                case 1:
                    dr["backColor"] = "#ff0000";
                    break;

                case 2:
                    dr["backColor"] = "#0000ff";
                    break;

                case 3:
                    dr["backColor"] = "#00cccf";
                    break;
                }

                dt.Rows.Add(dr);
            }


            return(dt);
        }