Ejemplo n.º 1
0
        public void DeleteUserGroup(Models.UserGroupDo entity)
        {
            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Delete_UserGroup]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(int), "GroupID", entity.GroupID);
                command.AddParameter(typeof(DateTime), "UpdateDate", entity.UpdateDate);
                command.AddParameter(typeof(string), "UpdateUser", entity.UpdateUser);

                command.ExecuteScalar();
            }));
        }
Ejemplo n.º 2
0
        public Models.UserGroupResultDo UpdateUserGroup(Models.UserGroupDo entity)
        {
            Models.UserGroupResultDo result = new Models.UserGroupResultDo();

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Update_UserGroup]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(int), "GroupID", entity.GroupID);
                command.AddParameter(typeof(string), "NameEN", entity.NameEN);
                command.AddParameter(typeof(string), "NameLC", entity.NameLC);
                command.AddParameter(typeof(string), "Description", entity.Description);
                command.AddParameter(typeof(decimal), "CashDiscount", entity.CashDiscount);
                command.AddParameter(typeof(decimal), "CreditDiscount", entity.CreditDiscount);
                command.AddParameter(typeof(bool), "FlagActive", entity.FlagActive);

                string userXML = Utils.ConvertUtil.ConvertToXml_Store <Models.UserInGroupDo>(entity.Users);
                command.AddParameter(typeof(string), "UserInGroupXML", userXML);

                string permissionXML = Utils.ConvertUtil.ConvertToXml_Store <Models.UserGroupPermissionDo>(entity.Permissions);
                command.AddParameter(typeof(string), "GroupPermissionXML", permissionXML);

                command.AddParameter(typeof(DateTime), "UpdateDate", entity.UpdateDate);
                command.AddParameter(typeof(string), "UpdateUser", entity.UpdateUser);

                Utils.SQL.ISQLDbParameter error = command.AddErrorParameter();

                List <Models.UserGroupDo> list = command.ToList <Models.UserGroupDo>();
                if (list != null)
                {
                    if (list.Count > 0)
                    {
                        result.Group = list[0];
                    }
                }
                result.ErrorParameter(error);
            }));
            if (result.Group != null)
            {
                result.Permissions = this.GetUserGroupPermission(new Common.DataSvc.Models.UserGroupCriteriaDo()
                {
                    GroupID = result.Group.GroupID
                });
            }

            return(result);
        }
Ejemplo n.º 3
0
        public Models.UserGroupDo GetUserGroup(Models.UserGroupCriteriaDo criteria)
        {
            Models.UserGroupDo result = null;

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Get_UserGroup]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(int), "GroupID", criteria.GroupID);

                List <Models.UserGroupDo> list = command.ToList <Models.UserGroupDo>();
                if (list != null)
                {
                    if (list.Count > 0)
                    {
                        result = list[0];
                    }
                }
            }));

            return(result);
        }