///Update
        public bool Update(DispatchTypeEntity dispatchtype)
        {
            bool res = false;

            try
            {
                var p = Param(dispatchtype, "edit");
                res = (bool)unitOfWork.ProcedureExecute("ptgroup_DispatchType_Update", p);
                return(res);
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
                return(res);
            }
        }
        /// <summary>
        /// Saves a record to the Employee table.
        /// </summary>
        private DynamicParameters Param(DispatchTypeEntity dispatchtype, string action = "add")
        {
            var p = new DynamicParameters();

            if (action == "add")
            {
                p.Add("@Id", dbType: DbType.Int32, direction: ParameterDirection.Output);
            }
            else
            {
                p.Add("@Id", dispatchtype.Id);
            }
            p.Add("@Name", dispatchtype.Name);
            p.Add("@Createdate", dispatchtype.Createdate);
            return(p);
        }
        public int Insert(DispatchTypeEntity dispatchtype)
        {
            int  res  = 0;
            bool flag = false;

            try
            {
                var p = Param(dispatchtype);
                flag = (bool)unitOfWork.ProcedureExecute("ptgroup_DispatchType_Insert", p);
                if (flag)
                {
                    res = p.Get <int>("@Id");
                }
                else
                {
                    res = 0;
                }
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
            }
            return(res);
        }