示例#1
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();
            }
        }
示例#2
0
        protected void TimePoPUP(object sender, DirectEventArgs e)
        {
            TabPanel1.ActiveIndex = 0;
            string employeeId     = e.ExtraParams["employeeId"];
            string employeeName   = e.ExtraParams["employeeName"];
            string dayId          = e.ExtraParams["dayId"];
            string dayIdDate      = e.ExtraParams["dayIdDate"];
            string timeCode       = e.ExtraParams["timeCode"];
            string timeCodeString = e.ExtraParams["timeCodeString"];
            string status         = e.ExtraParams["status"];
            string shiftId        = e.ExtraParams["shiftId"];
            string seqNo          = e.ExtraParams["seqNo"];
            string activityId     = e.ExtraParams["activityId"];


            string notes = e.ExtraParams["notes"];

            TimeApprovalRecordRequest r = new TimeApprovalRecordRequest();

            r.seqNo = seqNo;
            //r.timeCode = timeCode;
            //r.shiftId = shiftId;
            r.tvId = activityId;
            RecordResponse <TimeSelfService> response = _selfServiceService.ChildGetRecord <TimeSelfService>(r);

            if (!response.Success)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(response);
                return;
            }
            TimeStatus.Select(response.result.status.ToString());
            if (response.result.damageLevel == "1")
            {
                response.result.damageLevel = GetLocalResourceObject("DamageWITHOUT_DAMAGE").ToString();
            }
            else
            {
                response.result.damageLevel = GetLocalResourceObject("DamageWITH_DAMAGE").ToString();
            }

            TimeFormPanel.SetValues(response.result);


            TimeEmployeeName.Text = employeeName;
            // TimedayIdDate.Text = dayIdDate;
            TimeTimeCodeString.Text = timeCodeString;

            shiftIdTF.Text        = shiftId;
            TimeemployeeIdTF.Text = employeeId;

            TimeTimeCodeTF.Text = timeCode;



            FillTimeApproval(activityId);
            tvId.Text = activityId;

            this.TimeWindow.Title = Resources.Common.EditWindowsTitle;
            this.TimeWindow.Show();
        }