Ejemplo n.º 1
0
        public ResultModel Delete(string groupID)
        {
            ResultModel result = new ResultModel();

            Dictionary <string, object> saveData = new Dictionary <string, object>();

            saveData.Add("IsDeleted", 1);
            saveData.Add("DeletedBy", UserID);
            saveData.Add("DeletedTime", DateTime.Now);

            GroupDA groupDA = null;

            try
            {
                groupDA         = new GroupDA();
                result.Affected = groupDA.EditGroup(saveData, groupID);
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Exception = ex.Message;
            }
            finally
            {
                if (groupDA != null)
                {
                    groupDA.CloseConnection();
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public ResultModel DelUserGroup(string groupID, string UserUIDs)
        {
            ResultModel result = new ResultModel();
            Dictionary <string, object> DelData;
            GroupDA groupDA = null;

            try
            {
                groupDA = new GroupDA();
                foreach (var item in UserUIDs.Split(',').Where(z => z.Length > 0))
                {
                    DelData = new Dictionary <string, object>();
                    DelData.Add("GroupID", groupID);
                    DelData.Add("UserUID", item);
                    result.Affected = groupDA.DelUserGroup(DelData);
                }

                var UserGroups = groupDA.GetUserGroups(groupID);

                int count = UserGroups == null ? 0 : UserGroups.Rows.Count;

                DelData = new Dictionary <string, object>();

                DelData.Add("NumOfUsers", count);

                groupDA.EditGroup(DelData, groupID);
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Exception = ex.Message;
            }
            finally
            {
                if (groupDA != null)
                {
                    groupDA.CloseConnection();
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        public ResultModel Edit(GroupM model)
        {
            ResultModel result = new ResultModel();

            Dictionary <string, object> saveData = new Dictionary <string, object>();

            saveData.Add("GroupName", model.GroupName.Trim());
            saveData.Add("Description", model.Description);
            saveData.Add("LastModifiedBy", UserID);
            saveData.Add("LastModifiedTime", DateTime.Now);

            if (model.IsDeleted == 1)
            {
                saveData.Add("IsDeleted", model.IsDeleted);
                saveData.Add("DeletedBy", UserID);
                saveData.Add("DeletedTime", DateTime.Now);
            }

            GroupDA groupDA = null;

            try
            {
                groupDA         = new GroupDA();
                result.Affected = groupDA.EditGroup(saveData, model.GroupID);
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Exception = ex.Message;
            }
            finally
            {
                if (groupDA != null)
                {
                    groupDA.CloseConnection();
                }
            }
            return(result);
        }