コード例 #1
0
        protected void PoPuPBC(object sender, DirectEventArgs e)
        {
            int    id   = Convert.ToInt32(e.ExtraParams["id"]);
            string type = e.ExtraParams["type"];
            string path = e.ExtraParams["path"];

            switch (type)
            {
            case "imgEdit":
                RecordRequest r2 = new RecordRequest();
                r2.RecordID = id.ToString();
                RecordResponse <EmployeeBackgroundCheck> response2 = _employeeService.ChildGetRecord <EmployeeBackgroundCheck>(r2);
                if (!response2.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, response2.Summary).Show();
                    return;
                }
                //Step 2 : call setvalues with the retrieved object
                this.EditBCTab.SetValues(response2.result);
                FillBCCheckType();
                ctId.Select(response2.result.ctId.ToString());
                this.EditBCWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditBCWindow.Show();
                break;

            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteBC({0},'{1}')", id, path),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "imgAttach":
                DownloadFile(path);
                break;

            case "imgDeleteAttach":
                DeleteFile(path, id);
                BCStore.Reload();
                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
コード例 #2
0
        public void DeleteBC(string index, string path)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                EmployeeBackgroundCheck n = new EmployeeBackgroundCheck();
                n.recordId   = index;
                n.employeeId = 0;
                n.date       = DateTime.Now;
                n.expiryDate = DateTime.Now;
                n.remarks    = "";
                n.fileUrl    = path;

                PostRequest <EmployeeBackgroundCheck> req = new PostRequest <EmployeeBackgroundCheck>();
                req.entity = n;
                PostResponse <EmployeeBackgroundCheck> res = _employeeService.ChildDelete <EmployeeBackgroundCheck>(req);
                if (!res.Success)
                {
                    //Show an error saving...
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, res.Summary).Show();
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    BCStore.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();
            }
        }