public virtual ActionResult CreateProject(ProjectView created)
        {
            var startnode = _entities.FlowSteps.SingleOrDefault(x => x.FlowType ==2 && x.StepType == 0);

            if (ModelState.IsValid)
            {
                var newlayout = created.ToModel();
                newlayout.FlowState = startnode.StepID;
                var js = " $('.info_div').hide();$('#success').fadeIn('slow');";
                try
                {
                    _entities.DgProjects.AddObject(newlayout);
                    _entities.SaveChanges();
                    var log = new FlowLog
                    {
                        ProjectId = newlayout.ProjectId,
                        Startdate = DateTime.Now,
                        ActiveFlag = true,
                        ToDoby =
                            _entities.Users.SingleOrDefault(
                                x => x.UserName.Trim() == User.Identity.Name.Trim()).UserID,
                        LogStep = startnode.StepID
                    };
                    _entities.FlowLogs.AddObject(log);
                    _entities.SaveChanges();
                    return JavaScript(js);
                }
                catch
                {
                    js = " $('.info_div').hide();$('#fail').fadeIn('slow');";
                    return JavaScript(js);
                }
            }
            return JavaScript(" $('.info_div').hide(); $('#warning').fadeIn('slow');");
        }
Example #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the FlowLogs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFlowLogs(FlowLog flowLog)
 {
     base.AddObject("FlowLogs", flowLog);
 }
Example #3
0
 /// <summary>
 /// Create a new FlowLog object.
 /// </summary>
 /// <param name="logID">Initial value of the LogID property.</param>
 /// <param name="logStep">Initial value of the LogStep property.</param>
 /// <param name="toDoby">Initial value of the ToDoby property.</param>
 public static FlowLog CreateFlowLog(global::System.Int32 logID, global::System.Int32 logStep, global::System.Int32 toDoby)
 {
     FlowLog flowLog = new FlowLog();
     flowLog.LogID = logID;
     flowLog.LogStep = logStep;
     flowLog.ToDoby = toDoby;
     return flowLog;
 }