Exemple #1
0
        protected void fillLeavesStore()
        {
            LeaveRequestListRequest req = new LeaveRequestListRequest();



            //req.BranchId = 0;
            //req.DepartmentId = 0;
            //req.raEmployeeId = 0;


            //req.EmployeeId = Convert.ToInt32(employeeId.SelectedItem.Value);



            //req.status = 2;

            req.Params = "1|" + Convert.ToInt32(employeeId.SelectedItem.Value) + "^4|2";

            req.Size    = "50";
            req.StartAt = "0";
            req.SortBy  = "recordId";

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



            //check if the insert failed
            if (!resp.Success)//it maybe be another condition
            {
                //Show an error saving...
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(resp);
                return;
            }
            else
            {
                resp.Items.ForEach(x =>
                {
                    x.leaveRef = x.leaveRef + " " + x.startDate.ToString(_systemService.SessionHelper.GetDateformat()) + " " + x.endDate.ToString(_systemService.SessionHelper.GetDateformat());
                });
            }
            leaveIdStore.DataSource = resp.Items;
            leaveIdStore.DataBind();
        }
Exemple #2
0
        private LeaveRequestListRequest GetFilteredRequest()
        {
            LeaveRequestListRequest req = new LeaveRequestListRequest();

            var d = jobInfo1.GetJobInfo();

            //req.BranchId = d.BranchId.HasValue ? d.BranchId.Value : 0;
            //req.DepartmentId = d.DepartmentId.HasValue ? d.DepartmentId.Value : 0;

            BranchId     = d.BranchId.HasValue ? d.BranchId.Value : 0;
            DepartmentId = d.DepartmentId.HasValue ? d.DepartmentId.Value : 0;


            if (!string.IsNullOrEmpty(employeeFilter.Text) && employeeFilter.Value.ToString() != "0")
            {
                //req.EmployeeId = Convert.ToInt32(employeeFilter.Value);
                EmployeeId = Convert.ToInt32(employeeFilter.Value);
            }
            else
            {
                //req.EmployeeId = 0;
                EmployeeId = 0;
            }

            if (!string.IsNullOrEmpty(includeOpen.Text))
            {
                //req.status = Convert.ToInt32(includeOpen.Value);
                status = Convert.ToInt32(includeOpen.Value);
            }
            else
            {
                //req.status = 0;
                status = 0;
            }

            req.Params  = "1|" + EmployeeId + "^2|" + BranchId + "^3|" + DepartmentId + "^4|2";
            req.Size    = "50";
            req.StartAt = "0";
            req.SortBy  = "recordId";

            return(req);
        }
Exemple #3
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();
        }
Exemple #4
0
        private LeaveRequestListRequest GetFilteredRequest()
        {
            LeaveRequestListRequest req = new LeaveRequestListRequest();


            //var d = jobInfo1.GetJobInfo();
            //req.BranchId = d.BranchId.HasValue ? d.BranchId.Value : 0;
            //req.DepartmentId = d.DepartmentId.HasValue ? d.DepartmentId.Value : 0;
            //req.raEmployeeId = 0;

            //if (!string.IsNullOrEmpty(employeeFilter.Text) && employeeFilter.Value.ToString() != "0")
            //{
            //    req.EmployeeId = Convert.ToInt32(employeeFilter.Value);


            //}
            //else
            //{
            //    req.EmployeeId = 0;

            //}

            //if (!string.IsNullOrEmpty(LeveApprovalStatusFilter.GetApprovalStatus()))
            //{
            //    req.status = Convert.ToInt32(LeveApprovalStatusFilter.GetApprovalStatus());


            //}
            //else
            //{
            //    req.status = 0;

            //}



            return(req);
        }
Exemple #5
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);
        }