public bool AddDiscussions(BOTS_TblDiscussion objDiscussion)
        {
            bool status = false;
            BOTS_TblSubDiscussionData objsubdiscussion = new BOTS_TblSubDiscussionData();

            try
            {
                using (var context = new CommonDBContext())
                {
                    context.BOTS_TblDiscussion.AddOrUpdate(objDiscussion);
                    context.SaveChanges();
                    if (objDiscussion.Status == "WIP")
                    {
                        objsubdiscussion.DiscussionId = objDiscussion.Id;
                        objsubdiscussion.GroupId      = objDiscussion.GroupId;
                        objsubdiscussion.FollowupDate = objDiscussion.FollowupDate;
                        objsubdiscussion.Description  = objDiscussion.Description;
                        objsubdiscussion.Status       = objDiscussion.Status;
                        objsubdiscussion.UpdatedBy    = objDiscussion.AddedBy;
                        context.BOTS_TblSubDiscussionData.AddOrUpdate(objsubdiscussion);
                        context.SaveChanges();
                    }
                    status = true;
                }
            }
            catch (Exception ex)
            {
                newexception.AddException(ex, objDiscussion.GroupId);
            }

            return(status);
        }
示例#2
0
        public ActionResult AllDiscussions(string groupId, string isOnboarding)
        {
            CommonFunctions common = new CommonFunctions();

            groupId = common.DecryptString(groupId);

            var userDetails = (CustomerLoginDetail)Session["UserSession"];

            userDetails.CustomerName = CR.GetCustomerName(groupId);
            Session["UserSession"]   = userDetails;

            DiscussionViewModel objData       = new DiscussionViewModel();
            BOTS_TblDiscussion  objDiscussion = new BOTS_TblDiscussion();
            string GroupName = string.Empty;

            if (string.IsNullOrEmpty(isOnboarding))
            {
                var objGroup = CR.GetGroupDetails(Convert.ToInt32(groupId));
                GroupName = objGroup.GroupName;
            }
            else
            {
                var objGroup = CR.GetOnboardingGroupDetails(groupId);
                GroupName = objGroup.GroupName;
            }
            objDiscussion.GroupId   = groupId;
            objDiscussion.GroupName = GroupName;
            objData.objDiscussion   = objDiscussion;
            objData.lstDiscussions  = DR.GetDiscussions(groupId);
            objData.lstCallTypes    = DR.GetCallTypes();
            List <SelectListItem> callSubType = new List <SelectListItem>();
            SelectListItem        item        = new SelectListItem();

            item.Value = "0";
            item.Text  = "Please Select";
            callSubType.Add(item);
            objData.lstCallSubTypes = callSubType;

            return(View(objData));
        }
        public bool UpdateDiscussions(string id, string Desc, string Status, string LoginId)
        {
            BOTS_TblDiscussion        objDiscussion    = new BOTS_TblDiscussion();
            BOTS_TblSubDiscussionData objsubdiscussion = new BOTS_TblSubDiscussionData();
            bool status = false;

            try
            {
                using (var context = new CommonDBContext())
                {
                    int discussionId = Convert.ToInt32(id);
                    objDiscussion             = context.BOTS_TblDiscussion.Where(x => x.Id == discussionId).FirstOrDefault();
                    objDiscussion.UpdatedDate = DateTime.Now;
                    objDiscussion.Status      = Status;

                    context.BOTS_TblDiscussion.AddOrUpdate(objDiscussion);
                    context.SaveChanges();

                    objsubdiscussion.DiscussionId = objDiscussion.Id;
                    objsubdiscussion.GroupId      = objDiscussion.GroupId;
                    objsubdiscussion.FollowupDate = objDiscussion.FollowupDate;
                    objsubdiscussion.Description  = Desc;
                    objsubdiscussion.Status       = objDiscussion.Status;
                    objsubdiscussion.UpdatedBy    = LoginId;
                    objsubdiscussion.AddedDate    = DateTime.Now;
                    context.BOTS_TblSubDiscussionData.AddOrUpdate(objsubdiscussion);
                    context.SaveChanges();
                    status = true;
                }
            }
            catch (Exception ex)
            {
                newexception.AddException(ex, objDiscussion.GroupId);
            }

            return(status);
        }