Exemple #1
0
 virtual public Stream ProcessPart(Stream partData, Workshare.FCS.Lite.Base.DocumentText discoveryText, RelatedPartProvider relPartProvider, DocumentProcessingActions action)
 {
     Initialize();
     ConstructFilter(partData, discoveryText, action);
     ExecuteFilter();
     return m_outStream;
 }
 public DocxDocumentReader(Workshare.Policy.BinaryData data)
     : base(false)
 {
     m_data = data;
     m_data.LockInMemory();
     m_myData = false;
 }
		internal static IResolvedAction GetIResolvedAction(PolicyResponseObject pro, Workshare.PolicyContent.ResolvedAction raIn)
		{
			Workshare.Policy.Engine.ResolvedAction raOut = new Workshare.Policy.Engine.ResolvedAction();

			raOut.Sequence = raIn.Sequence;

			raOut.ContentCollection = new Collection<IContentItem>();
			if (raIn.Contents != null)
			{
				foreach (Workshare.PolicyContent.ContentItem item in raIn.Contents)
				{
					Workshare.Policy.Engine.ContentItem proItem = null;
					foreach (Workshare.Policy.Engine.ContentItem ci in pro.ContentCollection)
					{
						if (ci.File.ContentId == item.Id)
							proItem = ci;
					}
					if (proItem != null)
						raOut.ContentCollection.Add(proItem);
				}
			}

			raOut.ResponseAction = ActionAdaptor.GetIPolicyResponseAction(raIn.Action);

			return raOut;
		}
 public ConditionsResourceSelectorForm(Workshare.Policy.PolicyType type)
 {
     m_type = type;
     InitializeComponent();
     if (type == Workshare.Policy.PolicyType.ActiveContent)
         checkBox1.Enabled = false;
 }
		/// <summary>
		/// Creates a visual representation of a condition
		/// </summary>
		/// <returns>A ConditionMethodDisplay object</returns>
		public static ConditionDisplayBase CreateConditionDisplay(ICondition condition, Workshare.Policy.PolicyType type)
		{
			ConditionUnitFactory.PreDefinedConditionType conditionType = ConditionUnitFactory.PreDefinedConditionType.Undefined;

			try
			{
				conditionType = CustomAttributes.GetPreDefinedConditionType(condition);
			}
			catch (ArgumentException ex)
			{
				Logger.LogError("Condition is not one of our predefined types.");
				Logger.LogError(ex);
				return null;
			}

			switch (conditionType)
			{
			case ConditionUnitFactory.PreDefinedConditionType.ContentInFileContext:
				return new ConditionDisplayContentInFileContext(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.RegexInFileContext:
				return new ConditionDisplayRegexInFileContext(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.ContentInFileName:
				return new ConditionDisplayContentInFileName(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.RegexInFileName:
				return new ConditionDisplayRegexInFileName(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.FileSize:
				return new ConditionDisplayFileSize(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.FileType:
				return new ConditionDisplayFileType(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.HiddenDataInFile:
				return new ConditionDisplayHiddenDataInFile(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.CustomProperty:
				return new ConditionDisplayCustomProperty(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.PasswordProtectedFile:
				return new ConditionDisplayPasswordProtectedFile(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.DocumentRestrictions:
				return new ConditionDisplayDocumentRestrictions(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.PiiInFile:
				return new ConditionDisplayPiiInFile(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.FileProperty:
				return new ConditionDisplayFileProperty(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.EmbeddedEmail:
				return new ConditionDisplayEmbeddedEmail(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.EmailAdresses:
				return new ConditionDisplayEmailAddresses(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.HiddenDataInPDF:
				return new ConditionDisplayHiddenDataInPDF(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.TotalAttachmentSize:
				return new ConditionDisplayTotalAttachmentSize(condition, type);
			default:
				{
					Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
						"CONDITION_INVALID_PREDEFINED",
						"Workshare.PolicyDesigner.Properties.Resources",
						System.Reflection.Assembly.GetExecutingAssembly());
					Logger.LogError(errorMessage.LogString);
					throw new ArgumentException(errorMessage.DisplayString);
				}
			}
		}
 /// <summary>
 /// Display data
 /// </summary>
 public void Display(Workshare.Policy.PolicyType type)
 {
     m_isDisplaying = true;
     DisplayLogicComboBox();
     DisplayConditions(type);
     m_isDisplaying = false;
 }
 override protected void ConstructFilter(System.IO.Stream partData, Workshare.FCS.Lite.Base.DocumentText discoveryText, DocumentProcessingActions action)
 {
     ConstructFilterObject(discoveryText);
     m_xmlFilter.ConnectToInputStream(partData);//this doesn't write anything it is just going to store data for when we process the strings later
     if (action == DocumentProcessingActions.Clean)
         m_xmlFilter.IsCleaning = true;
 }
Exemple #8
0
		internal static IRoutingResponse GetIRoutingResponse(Workshare.PolicyContent.Routing routingIn)
		{
			if ( null == routingIn )
				return null;

			RoutingResponse routingOut = new RoutingResponse();

			routingOut.ActionSetId = string.Empty; //TODO:
			routingOut.RoutingId = string.Empty; //TODO:

			routingOut.Description = routingIn.Description;
			routingOut.Name = routingIn.Name;
			routingOut.Rating = routingIn.Rating;

			routingOut.Properties = new Dictionary<string, string>();
			if ( routingIn.Properties != null)
			{
				foreach (CustomProperty property in routingIn.Properties)
				{
					routingOut.Properties[property.Name] = property.Value;
				}
			}

			return routingOut;
		}
		private static object RetrieveActionPropValue(Workshare.PolicyContent.ActionProperty apIn)
		{
			Type actionPropType = Type.GetType(apIn.Type, false);
			if (null != actionPropType)
			{
				try
				{
					switch (actionPropType.FullName)
					{
						case "System.String":
							return apIn.Value;
						case "System.Boolean":
							return bool.Parse(apIn.Value);
						case "System.DateTime":
							return DateTime.Parse(apIn.Value, CultureInfo.InvariantCulture);
						default:
							return null;
					}
				}
				catch (Exception)
				{
					return null;
				}
			}

			return null;
		}
		/// <summary>
		/// Build up the display of condition resources. This will need to be refactored at some point to
		/// allow dynamic creation of condition types
		/// </summary>
		private void DisplayConditionResources(Workshare.Policy.PolicyType type)
		{
			int selectedRow = m_selectedAddExpressionRow;
			dataGridView1.Rows.Clear();

			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.ContentInFileContext, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.RegexInFileContext, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.PiiInFile, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.HiddenDataInFile, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.HiddenDataInPDF, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.PasswordProtectedFile, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.DocumentRestrictions, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.CustomProperty, type);
			//until we define _exactly_ what this condition should be doing then its exempt
			//DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.FileProperty, type);
			//DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.ContentInFileName);
			//DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.RegexInFileName);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.FileSize, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.FileType, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.EmbeddedEmail, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.EmailAdresses, type);
			DisplayConditionResource(ConditionUnitFactory.PreDefinedConditionType.TotalAttachmentSize, type);

			dataGridView1.AutoResizeColumn(0, DataGridViewAutoSizeColumnMode.AllCells);
			DataGridViewHelper.DoRowSelection(dataGridView1, selectedRow);
		}
        public ActionResult DeleteConfirmed(int id)
        {
            Workshare workshare = db.Workshares.Find(id);

            db.Workshares.Remove(workshare);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #12
0
		/// <summary>
		/// This method create the list view item from the message passed in.
		/// </summary>
		/// <param name="item">The item to be added</param>
        public override ListViewItem[] CreateRow(Workshare.Reports.MailMessage.Message item)
		{
            List<ListViewItem> lvis = new List<ListViewItem>();
			foreach (Document doc in item.Documents)
			{
				// Check to see if we need to show anything
				if (( Filter & doc.Policies.RiskRating ) > 0)
				{
					ListViewItem lvi = new ListViewItem();
					lvi.Text = doc.ToString( DefaultColumnName );
                    if (lvi.Text.Length == 0)
                    {
                        // Need Attachment or subject
                        if (doc.Type == Workshare.Reports.ContentType.Email)
                            lvi.Text = item.Subject;
                        else
                            lvi.Text = doc.Name;
                    }
					lvi.Tag = item;
					for (int i = 1; i < Columns.Count; i++)
					{
						ListViewItem.ListViewSubItem lvss = new ListViewItem.ListViewSubItem();
						ColumnHeader ch = Columns[i] as ColumnHeader;
						// Check to see if the column is really a rule        
						// Rating;Attachment;FailureReason;From;To;Date;Subject
						lvss.Name = ch.Name;
						if (string.Compare( ch.Name, "from", true, System.Threading.Thread.CurrentThread.CurrentCulture ) == 0)
							lvss.Text = item.Sender.Name;
						else if (string.Compare( ch.Name, "to", true, System.Threading.Thread.CurrentThread.CurrentCulture ) == 0 &&
							item.Recipients.Count > 0)
							lvss.Text = item.Recipients[0].Name;
						else if (string.Compare( ch.Name, "subject", true, System.Threading.Thread.CurrentThread.CurrentCulture ) == 0 &&
	 					    item.Recipients.Count > 0)
							lvss.Text = item.Subject;
                        else if (string.Compare(ch.Name, "mailbox", true, System.Threading.Thread.CurrentThread.CurrentCulture) == 0 &&
                            item.Recipients.Count > 0)
                            lvss.Text = item.MailBox;
						else if (string.Compare( ch.Name, "date", true, System.Threading.Thread.CurrentThread.CurrentCulture ) == 0)
						{
							StringBuilder ds = new StringBuilder();
							ds.AppendFormat( "{0} {1}", item.DateSent.ToShortDateString(), item.DateSent.ToShortTimeString() );
							lvss.Text = ds.ToString();
						}
						else
						{
							lvss.Text = doc.ToString( ch.Name );
						}
                        SetSubItemColour(lvi, item.SentExternally, lvss, doc.Policies.RiskRating);
						lvi.SubItems.Add( lvss );
					}
					SetIconIndex( lvi, doc.Type );
					SetItemColour( lvi, item.SentExternally, doc.Policies.RiskRating );
                    lvis.Add( lvi);
                }
			}
            return lvis.ToArray();
		}
 override protected StateMachineBasedXmlFilter ConstructFilterObject(Workshare.FCS.Lite.Base.DocumentText discoveryText)
 {
     if (m_preProcessing)
     {
         return new DiagramPreprocessingXmlFilter(discoveryText, m_commonNamespaces, m_contentTypesToDetect, ref m_DiagramHelper);
     }
     
     return new DiagramXmlFilter(discoveryText, m_commonNamespaces, m_contentTypesToDetect, ref m_DiagramHelper);
 }
 public ActionMatrixEventArgs(IPolicy policy, IPolicyChannel channel, IRoutingItemCollection senderCollection,
     IRoutingItemCollection recipientCollection, Workshare.Policy.ObjectModel.IAction action)
 {
     m_policy = policy;
     m_channel = channel;
     m_senderCollection = senderCollection;
     m_recipientCollection = recipientCollection;
     m_action = action;
 }
Exemple #15
0
		internal static IPolicyResponse GetIPolicyResponse(Workshare.PolicyContent.Policy policyIn)
		{
			if (null == policyIn)
				throw new ArgumentException("policy");
			

			PolicyResponse policyOut = new PolicyResponse();

			policyOut.Audit = policyIn.Audit;
			policyOut.Description = policyIn.Description;
			policyOut.Name = policyIn.Name;
			policyOut.Triggered = policyIn.Triggered;
			policyOut.RoutingId = null;  //TODO: Include RoutingId. How/Why!
			policyOut.Routing = RoutingAdaptor.GetIRoutingResponse(policyIn.Routing);
			
			if ( policyIn.Properties != null)
			{
				foreach (CustomProperty property in policyIn.Properties)
				{
					switch (property.Name)
					{
						case PolicyAdaptor.ExecuteBlockProp:
							policyOut.BlockOnException = bool.TrueString == property.Value;
							break;

						case PolicyConstants.SkipVerifiedMessages:
							policyOut.SkipVerifiedMessages = bool.TrueString == property.Value;
							break;

						default:
							policyOut.Properties[property.Name] = property.Value;
							break;
					}
				}
			}

			policyOut.ActionCollection = new Collection<IPolicyResponseAction>();
			if ( policyIn.Actions != null)
			{
				foreach (Workshare.PolicyContent.Action action in policyIn.Actions)
				{
					policyOut.ActionCollection.Add( ActionAdaptor.GetIPolicyResponseAction(action) );
				}
			}

			policyOut.ExpressionCollection = new Collection<IExpressionResponse>();
			if ( policyIn.Expressions != null)
			{
				foreach (Expression expression in policyIn.Expressions)
				{
					policyOut.ExpressionCollection.Add(ExpressionAdaptor.GetIExpressionResponse(expression));
				}
			}

			return policyOut;
		}
 public System.IO.Stream ProcessPart(System.IO.Stream partData, Workshare.FCS.Lite.Base.DocumentText discoveryText, RelatedPartProvider relPartProvider, DocumentProcessingActions action)
 {
     switch (action)
     {
         case DocumentProcessingActions.Discover:
             return null;
         default:
             return partData;
     }
 }
		public ConditionSummary(IPolicyObject conditionObject, Workshare.Policy.PolicyType type)
		{
			m_conditionObject = conditionObject;

			StringBuilder sb = new StringBuilder();

            ProcessConditionOrConditionGroup(m_conditionObject, sb, type);

			m_desc = sb.ToString();
		}
 /// <summary>
 /// constructor for displaying a specific instance of a condition
 /// </summary>
 /// <param name="condition">The condition to be displayed</param>
 public ConditionDisplayFileProperty(ICondition condition, Workshare.Policy.PolicyType type)
     : base(condition)
 {
     m_type = type;
     if (condition != null)
     {
         m_editable = true;
     }
     Initialise(Properties.Resources.IDS_EXPRESSION_FILEPROPERTY_DESCRIPTION, GetHyperlinks());
 }
 public ConditionDisplayParameterString(string name, IDataElement dataElement, RuleObject.OnExecuteHandler executeEventHandler, Workshare.Policy.PolicyType type)
     : base(name, null, type)
 {
     AddExecuteEventHandler(executeEventHandler);
     if (dataElement != null)
     {
         Object = dataElement;
         Text = GetDisplayName();
     }
 }
 protected override StateMachineBasedXmlFilter ConstructFilterObject(Workshare.FCS.Lite.Base.DocumentText discoveryText)
 {
     if (m_preprocessing)
     {
         m_preprocessWorkbookXmlFilter = new XlsxPreprocessWorkbookXmlFilter(discoveryText, m_commonNamespaces, m_contentTypesToDetect, m_piDictSheets);
         return m_preprocessWorkbookXmlFilter;
     }
     m_workbookXmlFilter = new XlsxWorkbookXmlFilter(discoveryText, m_commonNamespaces, m_contentTypesToDetect, DefinedNameLookup, WorkSheets.WorksheetLookup);
     return m_workbookXmlFilter;
 }
 protected virtual void OnPreviewResponseAction(Workshare.Policy.ClientManager.PreviewResponseActionArgs args)
 {
     lock (m_previewResponseActionLock)
     {
         if (m_previewResponseAction != null)
         {
             m_previewResponseAction(this, args);
         }
     }
 }
 /// <summary>
 /// constructor for displaying a specific instance of a condition
 /// </summary>
 /// <param name="condition">The condition to be displayed</param>
 public ConditionDisplayRegexInFileName(ICondition condition, Workshare.Policy.PolicyType type)
     : base(condition)
 {
     m_type = type;
     if (condition != null)
     {
         m_editable = true;
     }
     base.Initialise(Properties.Resources.IDS_EXPRESSION_REGEXINFILENAME_DESCRIPTION, GetHyperlinks());
 }
        public ConditionDisplayParameterOperator(ICondition condition, RuleObject.OnExecuteHandler executeEventHandler, Workshare.Policy.PolicyType type)
            : base(Properties.Resources.IDS_EXPRESSION_PARAM_OPERATOR_DEFAULT, null, type)
        {
            AddExecuteEventHandler(executeEventHandler);

            if (condition != null)
            {
                Object = condition;
                Text = GetDisplayName();
            }
        }
		void m_scanner_MailItem(object sender, Workshare.Trace.MailAdaptor.MailScanEventArgs e)
		{
			if (e.Uro == null)
			{
				IgnoredMessages.Add(e);
			}
			else
			{
				Messages.Add(e);
			}
		}
        /// <summary>
        /// constructor for displaying a specific instance of a condition
        /// </summary>
        /// <param name="condition">The condition to be displayed</param>
        public ConditionDisplayEmailAddresses(ICondition condition, Workshare.Policy.PolicyType type) 
            : base(condition)
        {
            m_type = type;

            if (condition != null)
            {
                m_editable = true;
            }
            base.Initialise(Properties.Resources.IDS_EXPRESSION_EMAILADDRESSES, GetHyperlinks());
        }
        /// <summary>
        /// constructor for displaying a specific instance of a condition
        /// </summary>
        /// <param name="condition">The condition to be displayed</param>
        public ConditionDisplayContentInFileContext(ICondition condition, Workshare.Policy.PolicyType type) 
            : base(condition)
        {
            m_type = type;

            if (condition != null)
            {
                m_editable = true;
            }
            base.Initialise(Properties.Resources.IDS_EXPRESSION_CONTENTINCONTEXT_DESCRIPTION, GetHyperlinks());
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataElement"></param>
        /// <returns></returns>
        public ConditionDisplayParameterFileName(IDataElement dataElement, RuleObject.OnExecuteHandler executeEventHandler, Workshare.Policy.PolicyType type)
            : base(Properties.Resources.IDS_EXPRESSION_PARAM_FILENAME_DEFAULT, null, type)
        {
            AddExecuteEventHandler(executeEventHandler);

            if (dataElement != null)
            {
                Object = dataElement;
                Text = GetDisplayName();
            }
        }
        public ConditionDisplayParameterContent(IDataElement contentElement, RuleObject.OnExecuteHandler executeEventHandler, Workshare.Policy.PolicyType type)
            : base(Properties.Resources.IDS_EXPRESSION_CONTENTPARAM_DEFAULT, contentElement, type)
        {
            AddExecuteEventHandler(executeEventHandler);

            if (contentElement != null)
            {
                this.Object = contentElement;
                this.Text = GetDisplayName();
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataElement"></param>
        /// <param name="executeEventHandler"></param>
        public ConditionDisplayParameterCustomPropertyValue(CustomPropertyType customPropertyType, IDataElement dataElement, RuleObject.OnExecuteHandler executeEventHandler, Workshare.Policy.PolicyType type)
            : base(Properties.Resources.IDS_EXPRESSION_PARAM_CUSTOMPROPERTYVALUE_DEFAULT, null, type)
        {
            AddExecuteEventHandler(executeEventHandler);
            m_type = customPropertyType;

            if (dataElement != null)
            {
                Object = dataElement;
                Text = GetDisplayName();
            }
        }
Exemple #30
0
		public static IPolicyResponseAction GetIPolicyResponseAction(Workshare.PolicyContent.Action actionIn)
		{
			if (null == actionIn)
				throw new ArgumentException("actionIn");

			PolicyResponseAction pra = new PolicyResponseAction();
			pra.Name = actionIn.Name;
			pra.Assembly = actionIn.Assembly;
			pra.ClassName = actionIn.ClassName;
			pra.Overridden = actionIn.Overriden;
			pra.Processed = actionIn.Processed;
			pra.Type = actionIn.Type;
			pra.IsExceptionAction = IsExceptionAction(actionIn);
			pra.Precedence = actionIn.Precedence;
			pra.Action = CreateInstanceOfAction(actionIn);

			if (actionIn.SupersededByAction != null)
			{
				pra.SupersededByAction = GetIPolicyResponseAction(actionIn.SupersededByAction);
			}

			pra.InternalProperties = new ActionPropertySet();
			if (actionIn.ActionProperties != null)
			{
				foreach (Workshare.PolicyContent.ActionProperty property in actionIn.ActionProperties)
				{
					IActionProperty actionProp = ActionPropertyAdaptor.GetIActionProperty(property);

					pra.InternalProperties[actionProp.DefaultDisplayName] = actionProp;
					pra.Action.PropertySet[actionProp.DefaultDisplayName] = actionProp;
				}

				foreach (Workshare.PolicyContent.ActionProperty property in actionIn.SystemProperties)
				{
					IActionProperty systemProp = ActionPropertyAdaptor.GetIActionProperty(property);
					pra.InternalProperties.SystemProperties[systemProp.DefaultDisplayName] = systemProp;
					pra.Action.PropertySet.SystemProperties[systemProp.DefaultDisplayName] = systemProp;
				}
			}

			//The 'Properties' field is hidden in PolicyResponseAction...use IPolicyResponseAction.
			IPolicyResponseAction iPra = pra;
			if ( actionIn.Properties != null)
			{
				foreach (CustomProperty property in actionIn.Properties)
				{
					iPra.Properties[property.Name] = property.Value;
				}
			}

			return pra;
		}
        public ConditionDisplayParameterAddressType(IDataElement dataElement, RuleObject.OnExecuteHandler executeEventHandler, List<AddressTypes> enumAddressTypes, Workshare.Policy.PolicyType type)
            : base(Properties.Resources.IDS_EXPRESSION_ADDRESSTYPE_DEFAULT, null, type)
        {
            AddExecuteEventHandler(executeEventHandler);

            m_enumAddressTypes = enumAddressTypes;

            if (dataElement != null)
            {
                Object = dataElement;
                Text = GetDisplayName();
            }
        }
 public ActionResult Edit([Bind(Include = "ID,Contract_Position_ID,Company_ID,Date_Released,IsPrimary,Created_On,Created_By,Modified_On,Modified_By")] Workshare workshare)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workshare).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DateTime             = DateTime.Now;
     ViewBag.Contract_Position_ID = new SelectList(db.Contract_Positions, "ID", "Contract_WBS_ID", workshare.Contract_Position_ID);
     ViewBag.Company_ID           = new SelectList(db.Ref_Companies, "ID", "Company", workshare.Company_ID);
     return(View(workshare));
 }
        // GET: Workshares/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Workshare workshare = db.Workshares.Find(id);

            if (workshare == null)
            {
                return(HttpNotFound());
            }
            return(View(workshare));
        }
        // GET: Workshares/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Workshare workshare = db.Workshares.Find(id);

            if (workshare == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DateTime             = DateTime.Now;
            ViewBag.Contract_Position_ID = new SelectList(db.Contract_Positions, "ID", "Contract_WBS_ID", workshare.Contract_Position_ID);
            ViewBag.Company_ID           = new SelectList(db.Ref_Companies, "ID", "Company", workshare.Company_ID);
            return(View(workshare));
        }