public void CreateNewTaskForAnroid(string description, string userid, string assigntoId, string comment)
        {
            string descritption = description;
            Guid idtoassign = Guid.Empty;
            idtoassign = Guid.Parse(assigntoId);

            Domain.Myfashion.Domain.Tasks objTask = new Domain.Myfashion.Domain.Tasks();
            TaskRepository objTaskRepo = new TaskRepository();
            objTask.AssignDate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
            objTask.AssignTaskTo = idtoassign;
            objTask.TaskStatus = false;
            objTask.TaskMessage = descritption;
            objTask.UserId = Guid.Parse(userid);
            Guid taskid = Guid.NewGuid();
            objTask.Id = taskid;
            objTaskRepo.addTask(objTask);

            /////////////////       
            string Comment = comment;
            if (!string.IsNullOrEmpty(comment))
            {
                string curdate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
                Domain.Myfashion.Domain.TaskComment objcmt = new Domain.Myfashion.Domain.TaskComment();
                TaskCommentRepository objcmtRepo = new TaskCommentRepository();
                objcmt.Comment = comment;
                objcmt.CommentDate = DateTime.Now;
                objcmt.EntryDate = DateTime.Now;
                objcmt.Id = Guid.NewGuid();
                objcmt.TaskId = objTask.Id;
                objcmt.UserId = Guid.Parse(userid);
                objcmtRepo.addTaskComment(objcmt);
            }
        }
        public string UpdateTasksByUserIdTaskId(string taskMessage, string assignTaskTo, string taskStatus, DateTime assignDate, string taskId, string userId)
        {
            string status = string.Empty;

            try
            {
                TaskRepository taskrepo = new TaskRepository();
                Domain.Myfashion.Domain.Tasks objTask = new Domain.Myfashion.Domain.Tasks();

                var Assign_Date = String.Format("{0:yyyy-M-d HH:mm:ss}", assignDate);
                //var Completion_Date = String.Format("{0:yyyy-M-d HH:mm:ss}", DateTime.Now);
                objTask.Id         = Guid.Parse(taskId);
                objTask.UserId     = Guid.Parse(userId);
                objTask.AssignDate = Convert.ToString(Assign_Date);
                //objTask.CompletionDate = DateTime.Parse(String.Format("{0:yyyy-M-d HH:mm:ss}", DateTime.Now));
                objTask.AssignTaskTo = Guid.Parse(assignTaskTo);
                objTask.TaskMessage  = taskMessage;
                objTask.TaskStatus   = Convert.ToBoolean(taskStatus);

                taskrepo.updateTask(objTask);

                status = "Success";
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return(new JavaScriptSerializer().Serialize(status));
        }
 /// <updateTask>
 /// Update Task
 /// </summary>
 /// <param name="task">Set Values in a Tasks Class Property and Pass the Object of Tasks Class.(Domein.Tasks)</param>
 public void updateTask(Domain.Myfashion.Domain.Tasks task)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 //Proceed action, to update task
                 session.CreateQuery("Update Tasks set TaskMessage =:TaskMessage,UserId =:UserId,AssignTaskTo =:AssignTaskTo,TaskStatus=:TaskStatus,AssignDate=:AssignDate where Id = :taskid and UserId = :userid")
                 .SetParameter("TaskMessage", task.TaskMessage)
                 .SetParameter("UserId", task.UserId)
                 .SetParameter("AssignTaskTo", task.AssignTaskTo)
                 .SetParameter("TaskStatus", task.TaskStatus)
                 .SetParameter("AssignDate", task.AssignDate)
                 .SetParameter("taskid", task.Id)
                 .SetParameter("userid", task.UserId)
                 .ExecuteUpdate();
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 // return 0;
             }
         } //End Transaction
     }     //End Session
 }
 /// <getTaskById>
 /// Get Task By Id
 /// </summary>
 /// <param name="Taskid">Task id.(string)</param>
 /// <param name="userId">User id.(Guid)</param>
 /// <returns>Return object of Tasks Class with  all Tasks info.(List<Tasks>)</returns>
 public Domain.Myfashion.Domain.Tasks getTaskById(string Taskid, Guid userId)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             //Proceed action, to get Account details by Fb user id and user id.
             NHibernate.IQuery query = session.CreateQuery("from FacebookAccount where FbUserId = :Fbuserid and UserId=:userId");
             query.SetParameter("Fbuserid", Taskid);
             query.SetParameter("userId", userId);
             Domain.Myfashion.Domain.Tasks result = (Domain.Myfashion.Domain.Tasks)query.UniqueResult();
             return(result);
         } //End Transaction
     }     //End Session
 }
 /// <addTask>
 /// Add New Task
 /// </summary>
 /// <param name="task">Set Values in a Tasks Class Property and Pass the Object of Tasks Class.(Domein.Tasks)</param>
 public void addTask(Domain.Myfashion.Domain.Tasks task)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 //Proceed action, to save new data.
                 session.Save(task);
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
         } //End Transaction
     }     //End Session
 }
        public string AddNewTaskWithGroupForApps(string description, string messagedate, string userid, string assigntoId, string comment, string groupid)
        {
            string descritption = description;
            Guid   idtoassign   = Guid.Empty;

            idtoassign = Guid.Parse(assigntoId);

            Domain.Myfashion.Domain.Tasks objTask = new Domain.Myfashion.Domain.Tasks();
            TaskRepository objTaskRepo            = new TaskRepository();

            objTask.AssignDate      = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
            objTask.AssignTaskTo    = idtoassign;
            objTask.TaskStatus      = false;
            objTask.TaskMessage     = descritption;
            objTask.TaskMessageDate = DateTime.Parse(messagedate).ToLocalTime();
            objTask.UserId          = Guid.Parse(userid);
            Guid taskid = Guid.NewGuid();

            objTask.Id      = taskid;
            objTask.GroupId = Guid.Parse(groupid);
            objTaskRepo.addTask(objTask);

            /////////////////
            string Comment = comment;

            if (!string.IsNullOrEmpty(comment))
            {
                string curdate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
                Domain.Myfashion.Domain.TaskComment objcmt = new Domain.Myfashion.Domain.TaskComment();
                TaskCommentRepository objcmtRepo           = new TaskCommentRepository();
                objcmt.Comment     = comment;
                objcmt.CommentDate = DateTime.Now;
                objcmt.EntryDate   = DateTime.Now;
                objcmt.Id          = Guid.NewGuid();
                objcmt.TaskId      = objTask.Id;
                objcmt.UserId      = Guid.Parse(userid);
                objcmtRepo.addTaskComment(objcmt);
            }
            return("success");
        }
        public void CreateNewTaskForAnroid(string description, string userid, string assigntoId, string comment)
        {
            string descritption = description;
            Guid   idtoassign   = Guid.Empty;

            idtoassign = Guid.Parse(assigntoId);

            Domain.Myfashion.Domain.Tasks objTask = new Domain.Myfashion.Domain.Tasks();
            TaskRepository objTaskRepo            = new TaskRepository();

            objTask.AssignDate   = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
            objTask.AssignTaskTo = idtoassign;
            objTask.TaskStatus   = false;
            objTask.TaskMessage  = descritption;
            objTask.UserId       = Guid.Parse(userid);
            Guid taskid = Guid.NewGuid();

            objTask.Id = taskid;
            objTaskRepo.addTask(objTask);

            /////////////////
            string Comment = comment;

            if (!string.IsNullOrEmpty(comment))
            {
                string curdate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
                Domain.Myfashion.Domain.TaskComment objcmt = new Domain.Myfashion.Domain.TaskComment();
                TaskCommentRepository objcmtRepo           = new TaskCommentRepository();
                objcmt.Comment     = comment;
                objcmt.CommentDate = DateTime.Now;
                objcmt.EntryDate   = DateTime.Now;
                objcmt.Id          = Guid.NewGuid();
                objcmt.TaskId      = objTask.Id;
                objcmt.UserId      = Guid.Parse(userid);
                objcmtRepo.addTaskComment(objcmt);
            }
        }
        public string AddNewTaskWithGroupForApps(string description, string messagedate, string userid, string assigntoId, string comment, string groupid)
        {
            string descritption = description;
            Guid idtoassign = Guid.Empty;
            idtoassign = Guid.Parse(assigntoId);

            Domain.Myfashion.Domain.Tasks objTask = new Domain.Myfashion.Domain.Tasks();
            TaskRepository objTaskRepo = new TaskRepository();
            objTask.AssignDate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
            objTask.AssignTaskTo = idtoassign;
            objTask.TaskStatus = false;
            objTask.TaskMessage = descritption;
            objTask.TaskMessageDate = DateTime.Parse(messagedate).ToLocalTime();
            objTask.UserId = Guid.Parse(userid);
            Guid taskid = Guid.NewGuid();
            objTask.Id = taskid;
            objTask.GroupId = Guid.Parse(groupid);
            objTaskRepo.addTask(objTask);

            /////////////////       
            string Comment = comment;
            if (!string.IsNullOrEmpty(comment))
            {
                string curdate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
                Domain.Myfashion.Domain.TaskComment objcmt = new Domain.Myfashion.Domain.TaskComment();
                TaskCommentRepository objcmtRepo = new TaskCommentRepository();
                objcmt.Comment = comment;
                objcmt.CommentDate = DateTime.Now;
                objcmt.EntryDate = DateTime.Now;
                objcmt.Id = Guid.NewGuid();
                objcmt.TaskId = objTask.Id;
                objcmt.UserId = Guid.Parse(userid);
                objcmtRepo.addTaskComment(objcmt);
            }
            return "success";
        }
        public string UpdateTasksByUserIdTaskId(string taskMessage, string assignTaskTo, string taskStatus, DateTime assignDate, string taskId, string userId)
        {
            string status = string.Empty;
            try
            {

                TaskRepository taskrepo = new TaskRepository();
                Domain.Myfashion.Domain.Tasks objTask = new Domain.Myfashion.Domain.Tasks();

                var Assign_Date = String.Format("{0:yyyy-M-d HH:mm:ss}", assignDate);
                //var Completion_Date = String.Format("{0:yyyy-M-d HH:mm:ss}", DateTime.Now);
                objTask.Id = Guid.Parse(taskId);
                objTask.UserId = Guid.Parse(userId);
                objTask.AssignDate = Convert.ToString(Assign_Date);
                //objTask.CompletionDate = DateTime.Parse(String.Format("{0:yyyy-M-d HH:mm:ss}", DateTime.Now));
                objTask.AssignTaskTo = Guid.Parse(assignTaskTo);
                objTask.TaskMessage = taskMessage;
                objTask.TaskStatus = Convert.ToBoolean(taskStatus);

                taskrepo.updateTask(objTask);

                status = "Success";
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return new JavaScriptSerializer().Serialize(status);
        }