private void editDocument()
 {
     editDocumentForm             = new EditDocumentForm(SelectedDocument);
     editDocumentForm.MaximizeBox = false;
     editDocumentForm.MinimizeBox = false;
     if (editDocumentForm.ShowDialog() == DialogResult.OK)
     {
         using (var db = new WereDesktopEntities())
         {
             updateScreen(db);
         }
     }
 }
예제 #2
0
        protected void SaveFolder(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string      obj = e.ExtraParams["values"];
            Attachement b   = JsonConvert.DeserializeObject <Attachement>(obj);

            b.recordId = 0;
            b.seqNo    = Convert.ToInt16(id);
            b.classId  = ClassId.DMDO;
            b.fileName = fileName.Text;
            // Define the object to add or edit as null
            b.folderName = folderId.SelectedItem.Text;


            try
            {
                //New Mode
                PostRequest <Attachement> req = new PostRequest <Attachement>();
                req.entity = b;



                PostResponse <Attachement> r = _systemService.ChildAddOrUpdate <Attachement>(req);



                //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
                {
                    ModelProxy record = this.Store1.GetById(id);

                    EditDocumentForm.UpdateRecord(record);
                    record.Set("folderName", b.folderName);


                    record.Commit();
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordUpdatedSucc
                    });
                    this.EditDocumentWindow.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();
            }
        }