Exemple #1
0
        private void FillTimeApproval(string tvId)
        {
            string rep_params = "";

            try
            {
                ReportGenericRequest r = new ReportGenericRequest();
                r.paramString = "12|" + tvId;



                ListResponse <Time> Times = _timeAttendanceService.ChildGetAll <Time>(r);
                if (!Times.Success)
                {
                    Common.errorMessage(Times);
                    return;
                }
                List <XMLDictionary> timeCodeList = ConstTimeVariationType.TimeCodeList(_systemService);
                int currentTimeCode;
                Times.Items.ForEach(x =>
                {
                    if (Int32.TryParse(x.timeCode, out currentTimeCode))
                    {
                        x.timeCodeString = timeCodeList.Where(y => y.key == Convert.ToInt32(x.timeCode)).Count() != 0 ? timeCodeList.Where(y => y.key == Convert.ToInt32(x.timeCode)).First().value : string.Empty;
                    }


                    x.statusString = FillApprovalStatus(x.status);
                });

                TimeStore.DataSource = Times.Items;
                //////List<ActiveLeave> leaves = new List<ActiveLeave>();
                ////leaves.Add(new ActiveLeave() { destination = "dc", employeeId = 8, employeeName = new Model.Employees.Profile.EmployeeName() { fullName = "vima" }, endDate = DateTime.Now.AddDays(10) });


                TimeStore.DataBind();
            }
            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
Exemple #2
0
        protected void FillTimeApproval(string dayId, int employeeId)
        {
            try
            {
                string rep_params = "";
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("1", employeeId.ToString());
                parameters.Add("2", dayId.ToString());
                parameters.Add("3", dayId.ToString());
                parameters.Add("4", "0");
                parameters.Add("5", "0");
                parameters.Add("6", "0");
                parameters.Add("7", "0");
                parameters.Add("8", "0");
                parameters.Add("9", "0");
                parameters.Add("10", "0");
                foreach (KeyValuePair <string, string> entry in parameters)
                {
                    rep_params += entry.Key.ToString() + "|" + entry.Value + "^";
                }
                if (rep_params.Length > 0)
                {
                    if (rep_params[rep_params.Length - 1] == '^')
                    {
                        rep_params = rep_params.Remove(rep_params.Length - 1);
                    }
                }



                ReportGenericRequest req = new ReportGenericRequest();
                req.paramString = rep_params;


                ListResponse <Time> Times = _timeAttendanceService.ChildGetAll <Time>(req);
                if (!Times.Success)
                {
                    Common.errorMessage(Times);
                    return;
                }
                Times.Items.ForEach(x =>
                {
                    x.timeCodeString = GetLocalResourceObject(x.timeCode + "text").ToString();
                    switch (x.status)
                    {
                    case 1:
                        x.statusString = pendingHF.Text;
                        break;

                    case 2:
                        x.statusString = approvedHF.Text;
                        break;
                    }
                });

                TimeStore.DataSource = Times.Items;
                ////List<ActiveLeave> leaves = new List<ActiveLeave>();
                //leaves.Add(new ActiveLeave() { destination = "dc", employeeId = 8, employeeName = new Model.Employees.Profile.EmployeeName() { fullName = "vima" }, endDate = DateTime.Now.AddDays(10) });


                TimeStore.DataBind();
            }
            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
Exemple #3
0
        protected void TimeStore_ReadData(object sender, StoreReadDataEventArgs e)
        {
            try
            {
                //DashboardRequest req = GetDashboardRequest();
                //DashboardTimeListRequest r = new DashboardTimeListRequest();
                //r.fromDayId = dateRange1.GetRange().DateFrom.ToString("yyyyMMdd");
                //r.toDayId = dateRange1.GetRange().DateTo.ToString("yyyyMMdd");
                //r.dayId = "";
                //r.employeeId = 0;
                //if (!string.IsNullOrEmpty(_systemService.SessionHelper.GetEmployeeId()))
                //    r.approverId = Convert.ToInt32(_systemService.SessionHelper.GetEmployeeId());

                //else
                //{
                //    TimeStore.DataSource = new List<Time>();
                //    TimeStore.DataBind();
                //    return;
                //}
                //r.timeCode = timeVariationType.GetTimeCode();
                //r.shiftId = "0";
                //r.apStatus = "1";
                //r.BranchId = req.BranchId;
                //r.DivisionId = req.DivisionId;
                //r.PositionId = req.PositionId;
                //r.DepartmentId = req.DepartmentId;
                //r.EsId = req.EsId;
                //r.Size = "50";
                //r.StartAt = "0";


                //ListResponse<TimeSelfService> Times = _selfServiceService.ChildGetAll<TimeSelfService>(r);
                string rep_params = vals.Text;
                TimeAttendanceViewListRequest req = new TimeAttendanceViewListRequest();
                req.paramString = rep_params;
                req.StartAt     = e.Start.ToString();
                req.Size        = "30";
                req.sortBy      = "dayId";
                ListResponse <TimeSelfService> Times = _selfServiceService.ChildGetAll <TimeSelfService>(req);



                if (!Times.Success)
                {
                    Common.errorMessage(Times);
                    return;
                }
                List <XMLDictionary> timeCodeList = ConstTimeVariationType.TimeCodeList(_systemService);
                int currentTimeCode;
                Times.Items.ForEach(x =>
                {
                    x.fullName     = x.employeeName;
                    x.statusString = FillApprovalStatus(x.status);
                    if (Int32.TryParse(x.timeCode, out currentTimeCode))
                    {
                        x.timeCodeString = timeCodeList.Where(y => y.key == Convert.ToInt32(x.timeCode)).Count() != 0 ? timeCodeList.Where(y => y.key == Convert.ToInt32(x.timeCode)).First().value : string.Empty;
                    }
                    if (string.IsNullOrEmpty(x.notes))
                    {
                        x.notes = " ";
                    }

                    //if (x.status == 2 || x.status == -1)
                    //{
                    //    btnApprovals.Disabled = true;
                    //    btnReject.Disabled = true;
                    //}
                    //else
                    //{
                    //    btnApprovals.Disabled = false;
                    //    btnReject.Disabled = false;
                    //}
                });

                // TimeStore.DataSource = Times.Items.Where(x=>x.status==1).ToList<Time>();
                ////List<ActiveLeave> leaves = new List<ActiveLeave>();
                //leaves.Add(new ActiveLeave() { destination = "dc", employeeId = 8, employeeName = new Model.Employees.Profile.EmployeeName() { fullName = "vima" }, endDate = DateTime.Now.AddDays(10) });

                TimeStore.DataSource = Times.Items;
                TimeStore.DataBind();
            }
            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
Exemple #4
0
        protected void FillTimeApproval(int dayId, int employeeId, string timeCode, string shiftId)
        {
            try
            {
                string rep_params = "";
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("1", employeeId.ToString());
                parameters.Add("2", dayId.ToString());
                parameters.Add("3", dayId.ToString());
                parameters.Add("4", shiftId);
                parameters.Add("5", timeCode);
                parameters.Add("6", "0");
                parameters.Add("7", "0");
                parameters.Add("8", "0");
                parameters.Add("9", "0");
                parameters.Add("10", "0");
                foreach (KeyValuePair <string, string> entry in parameters)
                {
                    rep_params += entry.Key.ToString() + "|" + entry.Value + "^";
                }
                if (rep_params.Length > 0)
                {
                    if (rep_params[rep_params.Length - 1] == '^')
                    {
                        rep_params = rep_params.Remove(rep_params.Length - 1);
                    }
                }



                ReportGenericRequest req = new ReportGenericRequest();
                req.paramString = rep_params;



                ListResponse <Time> Times = _timeAttendanceService.ChildGetAll <Time>(req);
                if (!Times.Success)
                {
                    Common.errorMessage(Times);
                    return;
                }
                List <XMLDictionary> timeCodeList = ConstTimeVariationType.TimeCodeList(_systemService);
                int currentTimeCode;
                Times.Items.ForEach(x =>
                {
                    if (Int32.TryParse(x.timeCode, out currentTimeCode))
                    {
                        x.timeCodeString = timeCodeList.Where(y => y.key == Convert.ToInt32(x.timeCode)).Count() != 0 ? timeCodeList.Where(y => y.key == Convert.ToInt32(x.timeCode)).First().value : string.Empty;
                    }

                    x.statusString = FillApprovalStatus(x.status);
                });

                TimeStore.DataSource = Times.Items;
                ////List<ActiveLeave> leaves = new List<ActiveLeave>();
                //leaves.Add(new ActiveLeave() { destination = "dc", employeeId = 8, employeeName = new Model.Employees.Profile.EmployeeName() { fullName = "vima" }, endDate = DateTime.Now.AddDays(10) });


                TimeStore.DataBind();
            }
            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }