示例#1
0
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                VacationSchedule s = new VacationSchedule();
                s.recordId = index;
                s.name     = "";

                PostRequest <VacationSchedule> req = new PostRequest <VacationSchedule>();
                req.entity = s;
                PostResponse <VacationSchedule> r = _branchService.ChildDelete <VacationSchedule>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                LeaveRequest s = new LeaveRequest();
                s.recordId      = index;
                s.destination   = "";
                s.employeeId    = "0";
                s.endDate       = DateTime.Now;
                s.startDate     = DateTime.Now;
                s.apStatus      = 0;
                s.isPaid        = false;
                s.justification = "";
                s.ltId          = 0;

                PostRequest <LeaveRequest> req = new PostRequest <LeaveRequest>();
                req.entity = s;
                PostResponse <LeaveRequest> r = _leaveManagementService.ChildDelete <LeaveRequest>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#3
0
        public void DeleteRecord(string id, string employeeId, string returnType)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                LeaveReturn s = new LeaveReturn();
                s.leaveId    = id;
                s.employeeId = employeeId;
                s.returnType = returnType;
                //s.reference = "";


                PostRequest <LeaveReturn> req = new PostRequest <LeaveReturn>();
                req.entity = s;
                PostResponse <LeaveReturn> r = _leaveManagementService.ChildDelete <LeaveReturn>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Reload();

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
示例#4
0
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                LeaveType s = new LeaveType();
                s.recordId        = index;
                s.reference       = "dd";
                s.requireApproval = false;
                s.name            = "";
                PostRequest <LeaveType> req = new PostRequest <LeaveType>();
                req.entity = s;
                PostResponse <LeaveType> r = _leaveManagementService.ChildDelete <LeaveType>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, r.Summary).Show();
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }