Пример #1
0
        public void DoYes()
        {
            try
            {
                RowSelectionModel sm = this.TimeGridPanel.GetSelectionModel() as RowSelectionModel;

                foreach (SelectedRow row in sm.SelectedRows)
                {
                    //Step 1 :Getting the id of the selected record: it maybe string
                    int id = int.Parse(row.RecordID);


                    //Step 2 : removing the record from the store
                    //To do add code here

                    //Step 3 :  remove the record from the store
                    TimeStore.Remove(id);
                }
                //Showing successful notification
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.ManyRecordDeletedSucc
                });
            }
            catch (Exception ex)
            {
                //Alert in case of any failure
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest && !IsPostBack)
            {
                SetExtLanguage();
                HideShowButtons();



                TimeStore.Reload();


                //if (string.IsNullOrEmpty(Request.QueryString["employeeId"]))
                //    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorOperation).Show();
                //CurrentEmployee.Text = Request.QueryString["employeeId"];

                DateColumn5.Format = TimedayIdDate.Format = _systemService.SessionHelper.GetDateformat();
                if (!string.IsNullOrEmpty(Request.QueryString["_employeeId"]) && !string.IsNullOrEmpty(Request.QueryString["_loanId"]))
                {
                    var p1  = new Ext.Net.Parameter("id", Request.QueryString["_loanId"]);
                    var p2  = new Ext.Net.Parameter("type", "imgEdit");
                    var col = new Ext.Net.ParameterCollection();
                    col.Add(p1);
                    col.Add(p2);
                    //   PoPuP(null, new DirectEventArgs(col));
                }
                //try
                //{
                //    AccessControlApplier.ApplyAccessControlOnPage(typeof(loanSelfService), BasicInfoTab, GridPanel1, btnAdd, SaveButton);

                //}
                //catch (AccessDeniedException exp)
                //{
                //    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                //    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorAccessDenied, "closeCurrentTab()").Show();
                //    Viewport1.Hidden = true;
                //    return;
                //}
                //try

                //{
                //    AccessControlApplier.ApplyAccessControlOnPage(typeof(LoanComment), null, loanCommentGrid, null, Button1);
                //    ApplyAccessControlOnLoanComments();
                //}
                //catch (AccessDeniedException exp)
                //{

                //    caseCommentsTab.Hidden = true;

                //}
                //if (purpose.InputType == InputType.Password)
                //{
                //    purpose.Visible = false;
                //    purposeField.Visible = true;
                //}
            }
        }
Пример #3
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();
            }
        }
Пример #4
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();
            }
        }
Пример #5
0
        public void Timebatch(string index)
        {
            try
            {
                string approve    = index;
                string rep_params = vals.Text;
                TimeAttendanceViewListRequest req = new TimeAttendanceViewListRequest();
                req.paramString = rep_params;
                req.StartAt     = "0";
                req.Size        = "1000";
                req.sortBy      = "dayId";
                ListResponse <TimeSelfService> Times = _selfServiceService.ChildGetAll <TimeSelfService>(req);

                //DashboardTimeListRequest r = new DashboardTimeListRequest();
                //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.StartAt = "0";
                //r.Size = "50";

                //ListResponse<TimeSelfService> Times = _selfServiceService.ChildGetAll<TimeSelfService>(r);
                if (!Times.Success)
                {
                    Common.errorMessage(Times);
                    return;
                }
                PostRequest <TimeSelfService>  request = new PostRequest <TimeSelfService>();
                PostResponse <TimeSelfService> resp;
                Times.Items.ForEach(x =>
                {
                    if (x.status != 2 && x.status != -1)
                    {
                        request.entity = x;
                        if (approve == "true")
                        {
                            request.entity.status = 2;
                        }
                        else
                        {
                            request.entity.status = -1;
                        }
                        resp = _selfServiceService.ChildAddOrUpdate <TimeSelfService>(request);
                        if (!resp.Success)
                        {
                            Common.errorMessage(resp);
                            throw new Exception();
                        }
                    }
                });
                TimeStore.Reload();
                //TimeStore.RemoveAll();
            }

            catch (Exception exp)
            {
                if (!string.IsNullOrEmpty(exp.Message))
                {
                    X.MessageBox.Alert(Resources.Common.Error, exp.Message).Show();
                }
            }
        }
Пример #6
0
        protected void SaveTimeRecord(object sender, DirectEventArgs e)
        {
            string obj   = e.ExtraParams["values"];
            string seqNo = e.ExtraParams["seqNo"];
            string tvId  = e.ExtraParams["tvId"];
            Time   TI    = JsonConvert.DeserializeObject <Time>(obj);

            try
            {
                //New Mode
                //Step 1 : Fill The object and insert in the store
                TimeApprovalRecordRequest recReq = new TimeApprovalRecordRequest();
                recReq.seqNo = seqNo;
                //r.timeCode = timeCode;
                //r.shiftId = shiftId;
                recReq.tvId = tvId;
                RecordResponse <TimeSelfService> recResp = _selfServiceService.ChildGetRecord <TimeSelfService>(recReq);
                if (!recResp.Success)
                {
                    Common.errorMessage(recResp);
                    return;
                }
                PostRequest <TimeSelfService> request = new PostRequest <TimeSelfService>();

                request.entity = recResp.result;
                if (recResp.result == null)
                {
                    return;
                }
                request.entity.status = TI.status;
                request.entity.notes  = TI.notes;


                PostResponse <TimeSelfService> r = _selfServiceService.ChildAddOrUpdate <TimeSelfService>(request);


                //check if the insert failed
                if (!r.Success)//it maybe be another condition
                {
                    //Show an error saving...
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);;
                    return;
                }
                else
                {
                    TimeStore.Reload();
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordSavingSucc
                    });

                    this.TimeWindow.Close();
                }
            }
            catch (Exception ex)
            {
                //Error exception displaying a messsage box
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
            }
        }
Пример #7
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();
            }
        }
Пример #8
0
 public SeasonController(TimeStore time)
 {
     _time = time;
 }
Пример #9
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();
            }
        }