/// <summary>
        /// Insert
        /// </summary>
        /// <param name="CommentId"></param>
        /// <returns></returns>
        public Message Insert(PRComment objUI)
        {
            Message msg = null;
            try
            {
                if (objUI != null)
                {
                    // Set more info

                    dbContext.PRComments.InsertOnSubmit(objUI);
                    dbContext.SubmitChanges();

                    // Show success message
                    msg = new Message(MessageConstants.I0001, MessageType.Info, objUI.Poster,"added a comment");
                }
            }
            catch
            {
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
Exemplo n.º 2
0
        public Message SaveControlToDB(FormCollection form, PerformanceReview pr, PRComment comment, bool isInsert)
        {
            Message msg = null;
            List<EForm_Detail> detailList = new List<EForm_Detail>();
            string EformID = form.Get("Hidden1");

            for (int i = 0; i < form.Count; i++)
            {
                string controlID = form.GetKey(i);
                bool flag = false;
                foreach (String str in control)
                {
                    if (controlID.StartsWith(str))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    CRM.Models.EForm_Detail detailItem = new Models.EForm_Detail();
                    string value = form.Get(controlID);
                    if (controlID.StartsWith("CheckBox"))
                    {
                        value = value.Split(Convert.ToChar(","))[0];
                    }
                    detailItem.ControlID = controlID;
                    detailItem.Value = value;
                    detailItem.EFormID = Int32.Parse(EformID);
                    detailList.Add(detailItem);

                }
            }
            CRM.Models.EformDao efDao = new EformDao();
            msg = isInsert == true ? efDao.Inser(detailList, pr, comment) : efDao.Update(detailList, pr, comment);

            return msg;
        }
Exemplo n.º 3
0
        public Message Inser(List<EForm_Detail> objList, PerformanceReview pr, PRComment comment)
        {
            Message msg = null;
            DbTransaction trans = null;
            try
            {
                dbContext.Connection.Open();
                trans = dbContext.Connection.BeginTransaction();
                dbContext.Transaction = trans;

                new PerformanceReviewDao().UpdateResolution(pr, comment);
                msg = Inser(objList);
                trans.Commit();
            }
            catch (Exception)
            {
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
                trans.Rollback();
            }
            return msg;
        }
Exemplo n.º 4
0
        public Message Update(List<EForm_Detail> newList, PerformanceReview pr, PRComment comment)
        {
            Message msg = null;
            DbTransaction trans = null;
            bool canSuccess = true;
            try
            {
                dbContext.Connection.Open();
                trans = dbContext.Connection.BeginTransaction();
                dbContext.Transaction = trans;
                List<EForm_Detail> oldList = dbContext.EForm_Details.Where(e => e.EFormID == newList[0].EFormID).ToList();
                dbContext.EForm_Details.DeleteAllOnSubmit(oldList);
                dbContext.EForm_Details.InsertAllOnSubmit(newList);
                dbContext.SubmitChanges();
                new PerformanceReviewDao().UpdateResolution(pr, comment);
                if (canSuccess)
                {
                    // Show succes message
                    msg = new Message(MessageConstants.I0001, MessageType.Info, "Interview", "updated");
                    trans.Commit();
                }
                else
                {
                    trans.Rollback();
                }

            }
            catch (Exception)
            {
                canSuccess = false;
                if (trans != null) trans.Rollback();
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Get list for manager
 /// </summary>
 /// <param name="empNameOrId"></param>
 /// <param name="status"></param>
 /// <param name="needSetup"></param>
 /// <returns></returns>
 public Message UpdateResolution(PerformanceReview objUI, PRComment objComment)
 {
     Message msg = null;
     DbTransaction trans = null;
     dbContext.Connection.Open();
     trans = dbContext.Connection.BeginTransaction();
     dbContext.Transaction = trans;
     try
     {
         PerformanceReview objDb = GetById(objUI.ID);
         if (objDb != null)
         {
             objDb.WFResolutionID = objUI.WFResolutionID;
             objDb.AssignID = objUI.ManagerID;
             objDb.AssignRole = objUI.AssignRole;
             objDb.InvolveID = objUI.InvolveID;
             objDb.InvolveRole = objUI.InvolveRole;
             objDb.InvolveDate = objUI.InvolveDate;
             objDb.InvolveResolution = objUI.InvolveResolution;
             objDb.UpdatedBy = objUI.UpdatedBy;
             objDb.UpdateDate = DateTime.Now;
             if (objComment != null)
             {
                 InsertComment(objComment);
             }
             dbContext.SubmitChanges();
             msg = new Message(MessageConstants.I0001, MessageType.Info, "Performance Review '" + objUI.ID + "'", "updated");
             trans.Commit();
         }
     }
     catch
     {
         if (trans != null) trans.Rollback();
         // Show system error
         msg = new Message(MessageConstants.E0007, MessageType.Error);
     }
     return msg;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Insert comment
 /// </summary>
 /// <param name="obj"></param>
 public void InsertComment(PRComment obj)
 {
     if (obj != null)
     {
         dbContext.PRComments.InsertOnSubmit(obj);
         dbContext.SubmitChanges();
     }
 }