public static bool CheckInItem(ISiteSetting siteSetting, IItem item, IConnectorExplorer connector) { CheckInForm checkInForm = new CheckInForm(); checkInForm.Initialize(siteSetting, item); if (checkInForm.ShowDialog(null, Languages.Translate("Check In Item")) == true) { string comment = checkInForm.Comments; CheckinTypes checkinType = checkInForm.CheckInType; IServiceManager serviceManager = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType); Result result; if (result = serviceManager.CheckInFile(siteSetting, item, comment, checkinType)) { if (checkInForm.KeepDocumentCheckedOut == true) { serviceManager.CheckOutFile(siteSetting, item); } else { if (connector != null) { item.Properties["ows__Level"] = "1"; //connector.ContentExplorer.UpdateItem(item.GetID(), item); } } } else { MessageBox.Show(result.detailResult, result.messageResult, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } } return(true); }
public static bool CheckOutItem(ISiteSetting siteSetting, IItem item, IConnectorExplorer connector) { IServiceManager serviceManager = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType); Result result = serviceManager.CheckOutFile(siteSetting, item); if (result) { if (connector != null) { item.Properties["ows__Level"] = "255"; //connector.ContentExplorer.UpdateItem(item.GetID(), item); } else { MessageBox.Show(result.detailResult, result.messageResult, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } } return(true); }