public ActionResult UpdateBuisnessSetting(FormCollection ObjFrmcollction)
        {
            Api.BusinessSetting.BusinessSetting ApiobjAddBusiness = new Api.BusinessSetting.BusinessSetting();
            Domain.Socioboard.Domain.BusinessSetting ObjbusinessSetting = new Domain.Socioboard.Domain.BusinessSetting();

            string BuisnessName = string.Empty;
            bool AssignTask;
            bool TaskNotification;

            BuisnessName = ObjFrmcollction["BuisnessName"].ToString();
            AssignTask = Convert.ToBoolean(ObjFrmcollction["IsTaskAssigned"].ToString());
            TaskNotification = Convert.ToBoolean(ObjFrmcollction["IsNotificationEnabled"].ToString());
            var SelectedGroupId = "";
            SelectedGroupId = ObjFrmcollction["BuisNessId"].ToString();
            ObjbusinessSetting.Id = Guid.Parse(SelectedGroupId);
            Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)Session["User"];
            ObjbusinessSetting.UserId = ObjUser.Id;
            ObjbusinessSetting.GroupId = Guid.Parse(Session["group"].ToString());
            ObjbusinessSetting.BusinessName = BuisnessName;
            ObjbusinessSetting.EntryDate = DateTime.Now;
            ObjbusinessSetting.AssigningTasks = AssignTask;
            ObjbusinessSetting.TaskNotification = TaskNotification;
            ObjbusinessSetting.FbPhotoUpload = 0;
            string ObjBsnsstng= (new JavaScriptSerializer().Serialize(ObjbusinessSetting));
            ApiobjAddBusiness.UpdateBuisnessSetting(ObjBsnsstng);
            return Content("Updated Successfully");
        }
Exemple #2
0
        /// <UpdateBusinessSetting>
        /// Update BusinessSetting by UserId.
        /// </summary>
        /// <param name="businessSetting">Set Values in a BusinessSetting Class Property and Pass the same Object of BusinessSetting Class.(Domain.BusinessSetting)</param>
        public void UpdateBusinessSetting(Domain.Socioboard.Domain.BusinessSetting businessSetting)
        {
            //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 Update Data.
                    // And Set the reuired paremeters to find the specific values.
                    session.CreateQuery("Update BusinessSetting set BusinessName =:businessName,AssigningTasks =:assigningTasks,TaskNotification =:taskNotification,FbPhotoUpload =:fbPhotoUpload,EntryDate =:entryDate where UserId =:userId and groupId=:groupId and BusinessName=:GroupName")
                    .SetParameter("businessName", businessSetting.BusinessName)
                    .SetParameter("assigningTasks", businessSetting.AssigningTasks)
                    .SetParameter("taskNotification", businessSetting.TaskNotification)
                    .SetParameter("fbPhotoUpload", businessSetting.FbPhotoUpload)
                    .SetParameter("entryDate", DateTime.Now)
                    .SetParameter("userId", businessSetting.UserId)
                    .SetParameter("groupId", businessSetting.GroupId)
                    .SetParameter("GroupName", businessSetting.BusinessName)
                    .ExecuteUpdate();

                    transaction.Commit();
                } //End Transaction
            }     //End session
        }
Exemple #3
0
        /// <AddBusinessSetting>
        /// Check If User Id is exist or Not. If User Id is Exist then It will Update that same Users all Business Setting. Otherwise It add a new Business Setting Data.
        /// </summary>
        /// <param name="businessSetting">Set Values in a BusinessSetting Class Property and Pass the same Object of BusinessSetting Class.(Domain.BusinessSetting)</param>
        public void AddBusinessSetting(Domain.Socioboard.Domain.BusinessSetting businessSetting)
        {
            //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 check if user is Exist or not.
                    List <Domain.Socioboard.Domain.BusinessSetting> lstBusinessSetting = CheckUserId(businessSetting.UserId, businessSetting.GroupId, businessSetting.BusinessName);

                    //if user is Exist the it update all BusinessSetting of the Same user,
                    //Otherwise it add New BusinessSetting.
                    if (lstBusinessSetting.Count > 0)
                    {
                        UpdateBusinessSetting(businessSetting);
                    }
                    else
                    {
                        session.Save(businessSetting);
                        transaction.Commit();
                    }
                } //End Transaction
            }     //End session
        }
        public ActionResult UpdateBuisnessSetting(FormCollection ObjFrmcollction)
        {
            Api.BusinessSetting.BusinessSetting      ApiobjAddBusiness  = new Api.BusinessSetting.BusinessSetting();
            Domain.Socioboard.Domain.BusinessSetting ObjbusinessSetting = new Domain.Socioboard.Domain.BusinessSetting();

            string BuisnessName = string.Empty;
            bool   AssignTask;
            bool   TaskNotification;

            BuisnessName     = ObjFrmcollction["BuisnessName"].ToString();
            AssignTask       = Convert.ToBoolean(ObjFrmcollction["IsTaskAssigned"].ToString());
            TaskNotification = Convert.ToBoolean(ObjFrmcollction["IsNotificationEnabled"].ToString());
            var SelectedGroupId = "";

            SelectedGroupId       = ObjFrmcollction["BuisNessId"].ToString();
            ObjbusinessSetting.Id = Guid.Parse(SelectedGroupId);
            Domain.Socioboard.Domain.User ObjUser = (Domain.Socioboard.Domain.User)Session["User"];
            ObjbusinessSetting.UserId           = ObjUser.Id;
            ObjbusinessSetting.GroupId          = Guid.Parse(Session["group"].ToString());
            ObjbusinessSetting.BusinessName     = BuisnessName;
            ObjbusinessSetting.EntryDate        = DateTime.Now;
            ObjbusinessSetting.AssigningTasks   = AssignTask;
            ObjbusinessSetting.TaskNotification = TaskNotification;
            ObjbusinessSetting.FbPhotoUpload    = 0;
            string ObjBsnsstng = (new JavaScriptSerializer().Serialize(ObjbusinessSetting));

            ApiobjAddBusiness.UpdateBuisnessSetting(ObjBsnsstng);
            return(Content("Updated Successfully"));
        }
        public IHttpActionResult AddGroup(Domain.Socioboard.Domain.Groups group) 
        {
            try
            {
                // GroupRepository grouprepo = new GroupRepository();
                if (!grouprepo.checkGroupExists(group.UserId, group.GroupName))
                {
                    // Domain.Socioboard.Domain.Groups group = new Domain.Socioboard.Domain.Groups();
                    group.EntryDate = DateTime.UtcNow;
                    group.Id = Guid.NewGuid();
                    grouprepo.AddGroup(group);
                    //code to add admin as group member
                    Domain.Socioboard.Domain.User objUser = objUserRepository.getUsersById(group.UserId);

                    Domain.Socioboard.Domain.Groupmembers grpMember = new Domain.Socioboard.Domain.Groupmembers();
                    grpMember.Id = Guid.NewGuid();
                    grpMember.Groupid = group.Id.ToString();
                    grpMember.Userid = group.UserId.ToString();
                    grpMember.Status = Domain.Socioboard.Domain.GroupUserStatus.Accepted ;
                    grpMember.Emailid = objUser.EmailId;
                    grpMember.IsAdmin = true;
                    grpMemberRepo.AddGroupMemeber(grpMember);


                    Api.Socioboard.Services.BusinessSetting ApiobjBusinesssSetting = new Api.Socioboard.Services.BusinessSetting();
                    Domain.Socioboard.Domain.BusinessSetting ObjBsnsStng = new Domain.Socioboard.Domain.BusinessSetting();
                    ObjBsnsStng.Id = Guid.NewGuid();
                    ObjBsnsStng.BusinessName = group.GroupName;
                    ObjBsnsStng.GroupId = group.Id;
                    ObjBsnsStng.AssigningTasks = false;
                    ObjBsnsStng.TaskNotification = false;
                    ObjBsnsStng.FbPhotoUpload = 0;
                    ObjBsnsStng.UserId = group.UserId;
                    ObjBsnsStng.EntryDate = DateTime.Now;
                    string ObjBsnsStg = (new JavaScriptSerializer().Serialize(ObjBsnsStng));
                    string BsnsMessage = ApiobjBusinesssSetting.AddBusinessByUser(ObjBsnsStg);
                    //return new JavaScriptSerializer().Serialize(group);
                    return Ok("Added Sucessfully");
                }
                else
                {
                    return BadRequest("Group Exist.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return BadRequest("Group Exist.");
            }
        }
        public IHttpActionResult AddGroup(Domain.Socioboard.Domain.Groups group)
        {
            try
            {
                // GroupRepository grouprepo = new GroupRepository();
                if (!grouprepo.checkGroupExists(group.UserId, group.GroupName))
                {
                    // Domain.Socioboard.Domain.Groups group = new Domain.Socioboard.Domain.Groups();
                    group.EntryDate = DateTime.UtcNow;
                    group.Id        = Guid.NewGuid();
                    grouprepo.AddGroup(group);
                    //code to add admin as group member
                    Domain.Socioboard.Domain.User objUser = objUserRepository.getUsersById(group.UserId);

                    Domain.Socioboard.Domain.Groupmembers grpMember = new Domain.Socioboard.Domain.Groupmembers();
                    grpMember.Id      = Guid.NewGuid();
                    grpMember.Groupid = group.Id.ToString();
                    grpMember.Userid  = group.UserId.ToString();
                    grpMember.Status  = Domain.Socioboard.Domain.GroupUserStatus.Accepted;
                    grpMember.Emailid = objUser.EmailId;
                    grpMember.IsAdmin = true;
                    grpMemberRepo.AddGroupMemeber(grpMember);


                    Api.Socioboard.Services.BusinessSetting  ApiobjBusinesssSetting = new Api.Socioboard.Services.BusinessSetting();
                    Domain.Socioboard.Domain.BusinessSetting ObjBsnsStng            = new Domain.Socioboard.Domain.BusinessSetting();
                    ObjBsnsStng.Id               = Guid.NewGuid();
                    ObjBsnsStng.BusinessName     = group.GroupName;
                    ObjBsnsStng.GroupId          = group.Id;
                    ObjBsnsStng.AssigningTasks   = false;
                    ObjBsnsStng.TaskNotification = false;
                    ObjBsnsStng.FbPhotoUpload    = 0;
                    ObjBsnsStng.UserId           = group.UserId;
                    ObjBsnsStng.EntryDate        = DateTime.Now;
                    string ObjBsnsStg  = (new JavaScriptSerializer().Serialize(ObjBsnsStng));
                    string BsnsMessage = ApiobjBusinesssSetting.AddBusinessByUser(ObjBsnsStg);
                    //return new JavaScriptSerializer().Serialize(group);
                    return(Ok("Added Sucessfully"));
                }
                else
                {
                    return(BadRequest("Group Exist."));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(BadRequest("Group Exist."));
            }
        }
Exemple #7
0
        public Domain.Socioboard.Domain.BusinessSetting IsNotificationTaskEnable(Guid groupId)
        {
            // bool flag = 0;
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                using (NHibernate.ITransaction transaction = session.BeginTransaction())
                {
                    List <Domain.Socioboard.Domain.BusinessSetting> lstdetails = session.CreateQuery("from BusinessSetting where groupId=:groupId")
                                                                                 .SetParameter("groupId", groupId).List <Domain.Socioboard.Domain.BusinessSetting>().ToList <Domain.Socioboard.Domain.BusinessSetting>();

                    Domain.Socioboard.Domain.BusinessSetting objBsnsStng = lstdetails[0];

                    return(objBsnsStng);
                }
            }
        }
        public Domain.Socioboard.Domain.BusinessSetting GetDetailsofBusinessOwner(Guid groupId)
        {
            // bool flag = 0;
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                using (NHibernate.ITransaction transaction = session.BeginTransaction())
                {
                    List <Domain.Socioboard.Domain.BusinessSetting> lstdetails = session.CreateQuery("from BusinessSetting where groupId=:groupId")
                                                                                 .SetParameter("groupId", groupId).List <Domain.Socioboard.Domain.BusinessSetting>().ToList <Domain.Socioboard.Domain.BusinessSetting>();

                    Domain.Socioboard.Domain.BusinessSetting objBsnsStng = new Domain.Socioboard.Domain.BusinessSetting();
                    if (lstdetails.Count > 0)
                    {
                        objBsnsStng = lstdetails[0];
                    }
                    else
                    {
                        objBsnsStng = null;
                    }
                    return(objBsnsStng);
                }
            }
        }
        public Domain.Socioboard.Domain.BusinessSetting GetDetailsofBusinessOwner(Guid groupId)
        {
            // bool flag = 0;
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                using (NHibernate.ITransaction transaction = session.BeginTransaction())
                {


                    List<Domain.Socioboard.Domain.BusinessSetting> lstdetails = session.CreateQuery("from BusinessSetting where groupId=:groupId")
                        .SetParameter("groupId", groupId).List<Domain.Socioboard.Domain.BusinessSetting>().ToList<Domain.Socioboard.Domain.BusinessSetting>();

                    Domain.Socioboard.Domain.BusinessSetting objBsnsStng = new Domain.Socioboard.Domain.BusinessSetting();
                    if (lstdetails.Count > 0)
                    {
                        objBsnsStng = lstdetails[0];
                    }
                    else {
                        objBsnsStng = null;
                    }
                    return objBsnsStng;


                }
            }
        }