/// <summary>
 /// Handles the Click event of the m_ButtonAddNew control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void m_ButtonAddNew_Click(object sender, EventArgs e)
 {
     try
     {
         Shipping _shpppng = CurrentShipping;
         if (m_Shipping == null)
         {
             return;
         }
         //if ( m_ExternalCheckBox.Checked && CurrentShipping.PartnerTitle == null )
         //{
         //  m_ExternalCheckBox.Checked = false;
         //  //TODO must be localized http://cas_sp:11225/sites/awt/Lists/TaskList/DispForm.aspx?ID=3842
         //  Parent.Controls.Add( GlobalDefinitions.ErrorLiteralControl( "Partner not set only internal messages allowed." ) );
         //  return;
         //}
         ShippingComments _new = new ShippingComments()
         {
             Body = m_ShippingCommentsTextBox.Text,
             //ExternalComment = m_ExternalCheckBox.Checked && CurrentShipping.PartnerTitle != null,
             ShippingComments2PartnerTitle = CurrentShipping.PartnerTitle,
             ShippingComments2ShippingID   = CurrentShipping,
         };
         EDC.Comments.InsertOnSubmit(_new);
         EDC.SubmitChanges();
         m_ShippingCommentsTextBox.Text = String.Empty;
     }
     catch (Exception ex)
     {
         Parent.Controls.Add(GlobalDefinitions.ErrorLiteralControl(ex.Message));
         Anons.WriteEntry(EDC, "m_ShippingCommentsTextBox_TextChanged", ex.Message);
     }
 }
        internal static void SetupConnections(EntitiesDataContext _edc, SPWeb _root)
        {
            SPFile file = _root.GetFile(URLVendorDashboard);

            System.Collections.Generic.Dictionary <string, WebPart> _dict = new System.Collections.Generic.Dictionary <string, WebPart>();
            Anons.WriteEntry(_edc, m_SourceClass + m_SourceSetupConnections, "Setup connections starting");
            string _phase = "starting";

            using (SPLimitedWebPartManager _pageMgr = file.GetLimitedWebPartManager(PersonalizationScope.Shared))
                try
                {
                    _dict  = _pageMgr.WebParts.Cast <WebPart>().ToDictionary(key => key.ID); //.ForEach(wp => wpMgr.DeleteWebPart(wp));
                    _phase = "After wpMgr.WebParts.Cast";
                    ConnectWebParts
                    (
                        _pageMgr,
                        _dict[IDCurrentUser],
                        _dict[IDCarrierDashboardWebPart],
                        CurrentUserWebPart.CurrentUserWebPart.CurrentUserProviderPoint,
                        CarrierDashboard.CarrierDashboardWebPart.CarrierDashboardWebPart.ConsumertIDPartnerInterconnection
                    );
                }
                catch (Exception ex)
                {
                    StringBuilder _names = new StringBuilder();
                    _dict.Keys.ToList <string>().ForEach(name => _names.Append(name + ", "));
                    string _msg = String.Format("Setup connections failed in Phase={0}, Count={1}, First={2}, Ex={3}", _phase, _dict.Count, _names.ToString(), ex.Message);
                    Anons.WriteEntry(_edc, m_SourceClass + m_SourceSetupConnections, _msg);
                    //throw new ApplicationException(_msg);
                }
            Anons.WriteEntry(_edc, m_SourceClass + m_SourceSetupConnections, "Setup connections finished");
        }
 private static void DeleteWebParts(EntitiesDataContext _edc, SPWeb _root)
 {
     Anons.WriteEntry(_edc, m_SourceClass + m_SourceDeleteWebParts, "Delete Web Parts strating");
     try
     {
         SPList        _wpl           = _root.GetCatalog(SPListTemplateType.WebPartCatalog);
         List <SPFile> _filesToDelete = new List <SPFile>();
         // figure out which Web Part template files need to be deleted
         Anons.WriteEntry
         (
             _edc, m_SourceClass + m_SourceDeleteWebParts,
             String.Format("Processing of the WebPartCatalog containing {0} items starting ", _wpl.ItemCount)
         );
         foreach (SPListItem _li in _wpl.Items)
         {
             bool _delete = _li.File.Name.StartsWith("ShepherdDashboards");
             if (_delete)
             {
                 _filesToDelete.Add(_li.File);
             }
             string _mess = String.Format("Title: {0}, Name: {1}, File name: {2}, deleted: {3}", _li.Title, _li.Name, _li.File.Name, _delete);
             Anons.WriteEntry(_edc, "Processing Web Part", _mess);
         }
         // delete Web Part template files
         foreach (SPFile file in _filesToDelete)
         {
             file.Delete();
         }
     }
     catch (Exception ex)
     {
         Anons.WriteEntry(_edc, m_SourceClass + m_SourceDeleteWebParts, "Delete Web Parts finished with exception: " + ex.Message);
     }
     Anons.WriteEntry(_edc, m_SourceClass + m_SourceDeleteWebParts, "Delete Web Parts finished");
 }
        private void SignalException(string _source, string _format, Exception _ex)
        {
            string _msg = String.Format(_format, _ex.Message);

            this.Controls.Add(new LiteralControl(_msg));
            Anons.WriteEntry(EDC, _source, _msg);
        }
        private void ReportException(string _source, Exception ex)
        {
            string _tmplt = "The current operation has been interrupted by error {0}.";
            Anons  _entry = new Anons(_source, String.Format(_tmplt, ex.Message));

            EDC.EventLogList.InsertOnSubmit(_entry);
            EDC.SubmitChanges();
        }
        private void ReportException(string _source, Exception _ex)
        {
            string _tmplt = "ReportExceptionTemplate".GetShepherdLocalizedString();
            Anons  _entry = Anons.CreateAnons(_source, String.Format(_tmplt, _ex.Message));

            EDC.EventLogList.InsertOnSubmit(_entry);
            EDC.SubmitChanges();
        }
        protected virtual void ShowActionResult(ActionResult _rslt)
        {
            if (_rslt.LastActionResult != ActionResult.Result.Exception)
            {
                return;
            }
            Anons _entry = Anons.CreateAnons(_rslt.ActionException.Source, _rslt.ActionException.Message);

            using (EntitiesDataContext _EDC = new EntitiesDataContext(SPContext.Current.Web.Url))
            {
                _EDC.EventLogList.InsertOnSubmit(_entry);
                _EDC.SubmitChanges();
            }
        }
 private void ReportException(string _source, Exception ex)
 {
     try
     {
         using (EntitiesDataContext EDC = new EntitiesDataContext(m_OnWorkflowActivated_WorkflowProperties.SiteUrl))
         {
             Anons _entry = new Anons()
             {
                 Title = _source, Body = String.Format("ReportExceptionTemplate".GetLocalizedString(), ex.Message), Expires = DateTime.Now + new TimeSpan(2, 0, 0, 0)
             };
             EDC.EventLogList.InsertOnSubmit(_entry);
             EDC.SubmitChanges();
         }
     }
     catch (Exception) { }
 }
        /// <summary>
        /// Occurs after a Feature is activated.
        /// </summary>
        /// <param name="properties">An <see cref="T:Microsoft.SharePoint.SPFeatureReceiverProperties" /> object that represents the properties of the event.</param>
        /// <exception cref="System.ApplicationException">
        /// In FeatureActivated the Site is null
        /// or
        /// </exception>
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            string _cp = "Starting";

            try
            {
                SPSite site = (SPSite)properties.Feature.Parent;
                if (site == null)
                {
                    throw new ApplicationException("In FeatureActivated the Site is null");
                }
                using (EntitiesDataContext _edc = new EntitiesDataContext(site.RootWeb.Url))
                {
                    Anons.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "FeatureActivated strating");
                    _cp = "ReplaceMasterMage";
                    ReplaceMasterMage(site);
                    Anons.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "Navigation setup starting");
                    _cp = "SPNavigationNodeCollection";
                    SPNavigationNodeCollection _topNav = site.RootWeb.Navigation.TopNavigationBar;
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuVendorTitle, ProjectElementManagement.URLVendorDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuInboundOwnerTitle, ProjectElementManagement.URLInboundOwner));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuViewInboundsTitle, ProjectElementManagement.URLViewInbounds));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuViewOutboundsTitle, ProjectElementManagement.URLViewOutbounds));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuOutboundOwnerTitle, ProjectElementManagement.URLOutboundOwner));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuOutboundCoordinatorTitle, ProjectElementManagement.URLOutboundCoordinator));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuForwarderTitle, ProjectElementManagement.URLForwarderDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuSecurityEscortProviderTitle, ProjectElementManagement.URLSecurityEscortProviderDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuSecurityGateTitle, ProjectElementManagement.URLGateDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuOperatorTitle, ProjectElementManagement.URLOperator));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuSupervisorTitle, ProjectElementManagement.URLSupervisor));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuDriversTitle, ProjectElementManagement.URLDrivers));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuTrucksTitle, ProjectElementManagement.URLTrucks));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuTrailersTitle, ProjectElementManagement.URLTrailers));
                    foreach (SPNavigationNode item in _topNav)
                    {
                        item.Update();
                    }
                    //WebPartPages.ProjectElementManagement.SetupConnections(_edc, _root);
                    _cp = "Entities.Anons";
                    Anons.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "FeatureActivated finished");
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("FeatureActivated exception at {0}: {1}", _cp, ex.Message));
            }
        }
        private void ShowActionResult(GenericStateMachineEngine.ActionResult _rslt)
        {
            if (_rslt.LastActionResult == GenericStateMachineEngine.ActionResult.Result.Success)
            {
                return;
            }
            if (_rslt.LastActionResult == GenericStateMachineEngine.ActionResult.Result.Exception)
            {
#if DEBUG
                string _format = CommonDefinitions.Convert2ErrorMessageFormat("Exception at: {0}/{1} of : {2}.");
                this.Controls.Add(GlobalDefinitions.ErrorLiteralControl(String.Format(_format, _rslt.ActionException.Source, At, _rslt.ActionException.Message)));
#endif
                Anons.WriteEntry(EDC, _rslt.ActionException.Source, _rslt.ActionException.Message);
            }
            else
            {
                string _format = CommonDefinitions.Convert2ErrorMessageFormat("Validation error at: {0}/{1} of : {2}.");
                this.Controls.Add(GlobalDefinitions.ErrorLiteralControl(String.Format(_format, _rslt.ActionException.Source, At, _rslt.ActionException.Message)));
            }
        }
 internal static void RemovePages(EntitiesDataContext _edc, SPWeb _root)
 {
     Anons.WriteEntry(_edc, m_SourceClass + m_SourceRemovePages, "Remove Pages starting");
     try
     {
         SPFolder WebPartPagesFolder = _root.GetFolder(ProjectElementManagement.WebPartPagesFolder);
         if (WebPartPagesFolder.Exists)
         {
             WebPartPagesFolder.Delete();
         }
         else
         {
             Anons.WriteEntry(_edc, m_SourceClass + m_SourceRemovePages, "Failed, the folder " + WebPartPagesFolder + "dies not exist.");
         }
     }
     catch (Exception ex)
     {
         Anons.WriteEntry(_edc, m_SourceClass + m_SourceRemovePages, "Remove pages failed with exception: " + ex.Message);
     }
     Anons.WriteEntry(_edc, m_SourceClass + m_SourceRemovePages, "Remove Pages finished");
 }
        /// <summary>
        /// Occurs when a Feature is deactivated.
        /// </summary>
        /// <param name="properties">An <see cref="T:Microsoft.SharePoint.SPFeatureReceiverProperties"/> object that represents the properties of the event.</param>
        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            SPSite _site = properties.Feature.Parent as SPSite;

            if (_site == null)
            {
                throw new ApplicationException("FeatureDeactivating cannot get access to the Web");
            }
            using (EntitiesDataContext _edc = new EntitiesDataContext(_site.RootWeb.Url))
            {
                Anons.WriteEntry(_edc, "FeatureDeactivating", "Feature Deactivation starting.");
                Anons.WriteEntry(_edc, "FeatureDeactivating", "Removing pages.");
                WebPartPages.ProjectElementManagement.RemovePages(_edc, _site.RootWeb);
                Anons.WriteEntry(_edc, "FeatureDeactivating", "Removing Navigation Entries.");
                RemoveNavigationEntries(_site.RootWeb);
                Anons.WriteEntry(_edc, "FeatureDeactivating", "Starting deletion of web parts.");
                DeleteWebParts(_edc, _site.RootWeb);
                Anons.WriteEntry(_edc, "FeatureDeactivating", "Reverting to default master page.");
                RevertMasterPage(_site);
                Anons.WriteEntry(_edc, "FeatureDeactivating", "Feature Deactivation finished.");
            }
        }
        private void m_TimeSlotList_SelectedIndexChanged(object sender, EventArgs e)
        {
            string _at = "Starting";

            m_TimeSlotSelection = true;
            if (m_TimeSlotList.SelectedValue.IsNullOrEmpty())
            {
                return;
            }
            try
            {
                _at = "TimeSlotTimeSlot";
                TimeSlotTimeSlot _slctdTmslt = Element.GetAtIndex(EDC.TimeSlot, m_TimeSlotList.SelectedValue);
                _slctdTmslt.IsDouble = m_ShowDoubleTimeSlots.Checked;
                _at = "m_InterconnectionDataTable_TimeSlotTimeSlot";
                m_InterconnectionDataTable_TimeSlotTimeSlot.SetData
                    (this, new InterconnectionDataTable <TimeSlotTimeSlot> .InterconnectionEventArgs(_slctdTmslt));
            }
            catch (Exception ex)
            {
                string _msg = String.Format("TimeSlotList_SelectedIndexChanged at: {0}", _at);
                Anons.WriteEntry(EDC, _msg, ex.Message);
            }
        }
Beispiel #14
0
 private void ExceptionCatched(string source, string message)
 {
     Anons.WriteEntry(EDC, source, message);
     this.Controls.Add(GlobalDefinitions.ErrorLiteralControl(message));
 }