Exemplo n.º 1
0
        /// <summary>
        /// Saves a record to the Depart_Module table.
        /// </summary>
        public int Insert(Depart_ModuleEntity depart_Module)
        {
            int  res  = 0;
            bool flag = false;

            try
            {
                var p = Param(depart_Module);
                flag = (bool)unitOfWork.ProcedureExecute("ptgroup_Depart_Module_Insert", p);
                if (flag)
                {
                    res = p.Get <int>("@Id");
                }
                else
                {
                    res = 0;
                }
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
                throw;
            }
            return(res);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates a record in the Depart_Module table.
        /// </summary>
        public bool Update(Depart_ModuleEntity depart_Module)
        {
            bool res = false;

            try
            {
                var p = Param(depart_Module, "edit");
                res = (bool)unitOfWork.ProcedureExecute("ptgroup_Depart_Module_Update", p);
                return(res);
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
                throw;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Saves a record to the Depart_Module table.
        /// </summary>
        private DynamicParameters Param(Depart_ModuleEntity depart_Module, string action = "add")
        {
            var p = new DynamicParameters();

            if (action == "edit")
            {
                p.Add("@Id", depart_Module.Id);
            }
            else
            {
                p.Add("@Id", dbType: DbType.Int32, direction: ParameterDirection.Output);
            }
            p.Add("@DepartId", depart_Module.DepartId);
            p.Add("@ModuleId", depart_Module.ModuleId);
            return(p);
        }