Example #1
0
 public ResponseResult ShareIdea(projectIdea proj)
 {
     try
     {
         Util.CustomUtility.LogData("Going to add new project idea:" + proj.ProjectTitle);
         return(Repository.saveProject(proj));
     }
     catch (Exception ex)
     {
         CustomUtility.HandleException(ex);
         return(ResponseResult.GetErrorObject());
     }
 }
Example #2
0
        //========================================================
        public int SaveProjectIdea(projectIdea proj, int UserId)
        {
            using (var ctx = new PRMDataContext())
            {
                string query = "execute sec.InitiateIdea @0, @1, @2, @3,@4, @5, @6,@7, @8,@9";
                var    args  = new DbParameter[] {
                    new SqlParameter {
                        ParameterName = "@0", Value = UserId
                    },
                    new SqlParameter {
                        ParameterName = "@1", Value = proj.ProjectId
                    },
                    new SqlParameter {
                        ParameterName = "@2", Value = proj.ProjectTitle
                    },
                    new SqlParameter {
                        ParameterName = "@3", Value = proj.Description
                    },
                    new SqlParameter {
                        ParameterName = "@4", Value = proj.Type
                    },
                    new SqlParameter {
                        ParameterName = "@5", Value = ""
                    },
                    new SqlParameter {
                        ParameterName = "@6", Value = proj.CreatedOn
                    },
                    new SqlParameter {
                        ParameterName = "@7", Value = proj.ModifiedOn
                    },
                    new SqlParameter {
                        ParameterName = "@8", Value = proj.IsActive
                    },
                    new SqlParameter {
                        ParameterName = "@9", Value = proj.ProjectState
                    }
                };

                var data = ctx.Database.SqlQuery <int>(query, args).FirstOrDefault();
                return(data);
            }
        }
Example #3
0
 public object SaveProject(projectIdea proj, int userId)
 {
     throw new NotImplementedException();
 }
Example #4
0
 public ResponseResult saveProject(projectIdea proj)
 {
     try
     {
         
         List<int> ids = new List<int>();
        
         proj.IsActive = true;
        // proj.PictureName = "mounatin.jpg";
         proj.CreatedOn = DateTime.UtcNow;
         proj.ModifiedOn = DateTime.UtcNow;
         proj.ProjectState = 2;
         //proj.PictureName = "ABC";
         String msg;
         var ProjectID = DataService.SaveProjectIdea(proj, SessionManager.CurrentUser.UserId);
         ids.Add(ProjectID);
         
         if (ProjectID > 0)
         {
             if (proj.MemberList.Count > 0 )
             {
                 Request res = new Request();
                 res.ProjectId = ProjectID;
                 res.RequestBody = "I want to do my final year project with you.";
                 res.Status = "pending";
                 res.Type = "AddStudent";
                 res.SendBy = SessionManager.CurrentUser.UserId;
                 res.CreatedOn = DateTime.UtcNow;
                 var RequestID = DataService.RequestHandling(res,proj.MemberList);
                 ids.Add(RequestID);
                 if (proj.SectionList.Count > 0)
                 {
                     Notification not = new Notification();
                     not.NotificationBody = "you can bid on this idea";
                     not.Title = "bid";
                     not.CreatedOn = DateTime.UtcNow;
                     not.ProjectId = ProjectID;
                     not.SendBy= SessionManager.CurrentUser.UserId;
                     var NotificationID = DataService.NotificationHandling(not,proj.SectionList);
                     ids.Add(NotificationID);
                 }
                   
             }
             if (proj.ProjectId > 0)
             {
                 msg = "Idea is updated Successfully";
             }
             else
             {
                 msg = "Idea is Initiated Successfully";
             }
             return ResponseResult.GetSuccessObject(new
             {
                 result = ids,
             }, 
             msg);
         }
         else
         {
             return ResponseResult.GetErrorObject();
         }
     } 
     // end of try block
     catch (Exception ex)
     {
         CustomUtility.HandleException(ex);
         return ResponseResult.GetErrorObject();
     }
 }